From e645994bbe6f231d05beebddfc186d5dd1e1b5e0 Mon Sep 17 00:00:00 2001 From: Leandro Lafin Date: Thu, 11 Jul 2024 17:56:20 -0300 Subject: [PATCH] Fixing format for v7.5.0 --- pkg/apis/options/load_test.go | 2 +- pkg/apis/options/options.go | 6 +++--- pkg/apis/sessions/interfaces.go | 2 +- pkg/sessions/cookie/session_store.go | 2 +- pkg/sessions/persistence/interfaces.go | 2 +- pkg/sessions/persistence/manager.go | 2 +- pkg/sessions/redis/client.go | 2 +- pkg/sessions/redis/lock.go | 2 +- pkg/sessions/redis/redis_store.go | 2 +- pkg/sessions/redis/redis_test.go | 2 +- pkg/sessions/tests/session_store_tests.go | 2 +- providers/gitlab.go | 2 +- providers/keycloak_oidc.go | 2 +- providers/nextcloud.go | 2 +- providers/providers.go | 2 +- providers/providers_test.go | 11 ++++++----- 16 files changed, 23 insertions(+), 22 deletions(-) diff --git a/pkg/apis/options/load_test.go b/pkg/apis/options/load_test.go index 8ba4f305be..90ac16e6d9 100644 --- a/pkg/apis/options/load_test.go +++ b/pkg/apis/options/load_test.go @@ -50,7 +50,7 @@ var _ = Describe("Load", func() { Options: Options{ ProxyPrefix: "/oauth2", PingPath: "/ping", - ReadyPath: "/ready", + ReadyPath: "/ready", RealClientIPHeader: "X-Real-IP", ForceHTTPS: false, Cookie: cookieDefaults(), diff --git a/pkg/apis/options/options.go b/pkg/apis/options/options.go index a2b507befc..45c0b141b0 100644 --- a/pkg/apis/options/options.go +++ b/pkg/apis/options/options.go @@ -21,7 +21,7 @@ type Options struct { ProxyPrefix string `flag:"proxy-prefix" cfg:"proxy_prefix"` PingPath string `flag:"ping-path" cfg:"ping_path"` PingUserAgent string `flag:"ping-user-agent" cfg:"ping_user_agent"` - ReadyPath string `flag:"ready-path" cfg:"ready_path"` + ReadyPath string `flag:"ready-path" cfg:"ready_path"` ReverseProxy bool `flag:"reverse-proxy" cfg:"reverse_proxy"` RealClientIPHeader string `flag:"real-client-ip-header" cfg:"real_client_ip_header"` TrustedIPs []string `flag:"trusted-ip" cfg:"trusted_ips"` @@ -105,7 +105,7 @@ func NewOptions() *Options { ProxyPrefix: "/oauth2", Providers: providerDefaults(), PingPath: "/ping", - ReadyPath: "/ready", + ReadyPath: "/ready", RealClientIPHeader: "X-Real-IP", ForceHTTPS: false, Cookie: cookieDefaults(), @@ -143,7 +143,7 @@ func NewFlagSet() *pflag.FlagSet { flagSet.String("proxy-prefix", "/oauth2", "the url root path that this proxy should be nested under (e.g. //sign_in)") flagSet.String("ping-path", "/ping", "the ping endpoint that can be used for basic health checks") flagSet.String("ping-user-agent", "", "special User-Agent that will be used for basic health checks") - flagSet.String("ready-path", "/ready", "the ready endpoint that can be used for deep health checks") + flagSet.String("ready-path", "/ready", "the ready endpoint that can be used for deep health checks") flagSet.String("session-store-type", "cookie", "the session storage provider to use") flagSet.Bool("session-cookie-minimal", false, "strip OAuth tokens from cookie session stores if they aren't needed (cookie session store only)") flagSet.String("redis-connection-url", "", "URL of redis server for redis session storage (eg: redis://HOST[:PORT])") diff --git a/pkg/apis/sessions/interfaces.go b/pkg/apis/sessions/interfaces.go index 80980f919f..97c364cf70 100644 --- a/pkg/apis/sessions/interfaces.go +++ b/pkg/apis/sessions/interfaces.go @@ -12,7 +12,7 @@ type SessionStore interface { Save(rw http.ResponseWriter, req *http.Request, s *SessionState) error Load(req *http.Request) (*SessionState, error) Clear(rw http.ResponseWriter, req *http.Request) error - VerifyConnection(ctx context.Context) error + VerifyConnection(ctx context.Context) error } var ErrLockNotObtained = errors.New("lock: not obtained") diff --git a/pkg/sessions/cookie/session_store.go b/pkg/sessions/cookie/session_store.go index 1734cc105e..f2f4045f2d 100644 --- a/pkg/sessions/cookie/session_store.go +++ b/pkg/sessions/cookie/session_store.go @@ -1,7 +1,7 @@ package cookie import ( - "context" + "context" "errors" "fmt" "net/http" diff --git a/pkg/sessions/persistence/interfaces.go b/pkg/sessions/persistence/interfaces.go index 73a6a4294e..5bab991282 100644 --- a/pkg/sessions/persistence/interfaces.go +++ b/pkg/sessions/persistence/interfaces.go @@ -15,5 +15,5 @@ type Store interface { Load(context.Context, string) ([]byte, error) Clear(context.Context, string) error Lock(key string) sessions.Lock - VerifyConnection(context.Context) error + VerifyConnection(context.Context) error } diff --git a/pkg/sessions/persistence/manager.go b/pkg/sessions/persistence/manager.go index 99391818cd..9652f015ec 100644 --- a/pkg/sessions/persistence/manager.go +++ b/pkg/sessions/persistence/manager.go @@ -1,7 +1,7 @@ package persistence import ( - "context" + "context" "fmt" "net/http" "time" diff --git a/pkg/sessions/redis/client.go b/pkg/sessions/redis/client.go index 75c97aa9ac..00cff17cec 100644 --- a/pkg/sessions/redis/client.go +++ b/pkg/sessions/redis/client.go @@ -14,7 +14,7 @@ type Client interface { Lock(key string) sessions.Lock Set(ctx context.Context, key string, value []byte, expiration time.Duration) error Del(ctx context.Context, key string) error - Ping(ctx context.Context) error + Ping(ctx context.Context) error } var _ Client = (*client)(nil) diff --git a/pkg/sessions/redis/lock.go b/pkg/sessions/redis/lock.go index dc4b45e8ec..cf4af25795 100644 --- a/pkg/sessions/redis/lock.go +++ b/pkg/sessions/redis/lock.go @@ -8,7 +8,7 @@ import ( "github.com/bsm/redislock" "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions" - "github.com/redis/go-redis/v9" + "github.com/redis/go-redis/v9" ) const LockSuffix = "lock" diff --git a/pkg/sessions/redis/redis_store.go b/pkg/sessions/redis/redis_store.go index 63ffbe35db..b3b3ab1a82 100644 --- a/pkg/sessions/redis/redis_store.go +++ b/pkg/sessions/redis/redis_store.go @@ -12,7 +12,7 @@ import ( "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions" "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger" "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/sessions/persistence" - "github.com/redis/go-redis/v9" + "github.com/redis/go-redis/v9" ) // SessionStore is an implementation of the persistence.Store diff --git a/pkg/sessions/redis/redis_test.go b/pkg/sessions/redis/redis_test.go index d3705f86ab..5725759c6c 100644 --- a/pkg/sessions/redis/redis_test.go +++ b/pkg/sessions/redis/redis_test.go @@ -9,7 +9,7 @@ import ( "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/redis/go-redis/v9" + "github.com/redis/go-redis/v9" ) // wrappedRedisLogger wraps a logger so that we can coerce the logger to diff --git a/pkg/sessions/tests/session_store_tests.go b/pkg/sessions/tests/session_store_tests.go index 3bf3e5aaf4..0416b24f34 100644 --- a/pkg/sessions/tests/session_store_tests.go +++ b/pkg/sessions/tests/session_store_tests.go @@ -486,7 +486,7 @@ func SessionStoreInterfaceTests(in *testInput) { }) }) - Context("when VerifyConnection is called", func() { + Context("when VerifyConnection is called", func() { It("should return without an error", func() { Expect(in.ss().VerifyConnection(in.request.Context())).ToNot(HaveOccurred()) }) diff --git a/providers/gitlab.go b/providers/gitlab.go index 3705f8405f..05072ea51e 100644 --- a/providers/gitlab.go +++ b/providers/gitlab.go @@ -32,7 +32,7 @@ var _ Provider = (*GitLabProvider)(nil) // NewGitLabProvider initiates a new GitLabProvider func NewGitLabProvider(p *ProviderData, opts options.GitLabOptions) (*GitLabProvider, error) { - p.setProviderDefaults(providerDefaults{ + p.setProviderDefaults(providerDefaults{ name: gitlabProviderName, }) if p.Scope == "" { diff --git a/providers/keycloak_oidc.go b/providers/keycloak_oidc.go index e6024fbde6..6e85136b4e 100644 --- a/providers/keycloak_oidc.go +++ b/providers/keycloak_oidc.go @@ -17,7 +17,7 @@ type KeycloakOIDCProvider struct { // NewKeycloakOIDCProvider makes a KeycloakOIDCProvider using the ProviderData func NewKeycloakOIDCProvider(p *ProviderData, opts options.KeycloakOptions) *KeycloakOIDCProvider { - p.setProviderDefaults(providerDefaults{ + p.setProviderDefaults(providerDefaults{ name: keycloakOIDCProviderName, }) diff --git a/providers/nextcloud.go b/providers/nextcloud.go index 8f1ff87b2c..fe46d7c2f6 100644 --- a/providers/nextcloud.go +++ b/providers/nextcloud.go @@ -21,7 +21,7 @@ const nextCloudProviderName = "Nextcloud" // NewNextcloudProvider initiates a new NextcloudProvider func NewNextcloudProvider(p *ProviderData) *NextcloudProvider { - p.setProviderDefaults(providerDefaults{ + p.setProviderDefaults(providerDefaults{ name: nextCloudProviderName, }) p.getAuthorizationHeaderFunc = makeOIDCHeader diff --git a/providers/providers.go b/providers/providers.go index 49db8fa632..ed887c4f2c 100644 --- a/providers/providers.go +++ b/providers/providers.go @@ -147,7 +147,7 @@ func newProviderDataFromConfig(providerConfig options.Provider) (*ProviderData, logger.Printf("Warning: Your provider supports PKCE methods %+q, but you have not enabled one with --code-challenge-method", p.SupportedCodeChallengeMethods) } - if providerConfig.OIDCConfig.UserIDClaim == "" { + if providerConfig.OIDCConfig.UserIDClaim == "" { providerConfig.OIDCConfig.UserIDClaim = "email" } diff --git a/providers/providers_test.go b/providers/providers_test.go index e445b0bd4f..7923ad269b 100644 --- a/providers/providers_test.go +++ b/providers/providers_test.go @@ -125,7 +125,7 @@ func TestScope(t *testing.T) { testCases := []struct { name string - configuredType options.ProviderType + configuredType options.ProviderType configuredScope string expectedScope string allowedGroups []string @@ -133,23 +133,23 @@ func TestScope(t *testing.T) { { name: "oidc: with no scope provided", configuredScope: "", - configuredType: "oidc", + configuredType: "oidc", expectedScope: "openid email profile", }, { name: "oidc: with no scope provided and groups", - configuredType: "oidc", + configuredType: "oidc", configuredScope: "", expectedScope: "openid email profile groups", allowedGroups: []string{"foo"}, }, { name: "oidc: with a configured scope provided", - configuredType: "oidc", + configuredType: "oidc", configuredScope: "openid", expectedScope: "openid", }, - { + { name: "github: with no scope provided", configuredType: "github", configuredScope: "", @@ -269,3 +269,4 @@ func TestEmailClaimCorrectlySet(t *testing.T) { g.Expect(pd.EmailClaim).To(Equal(tc.expectedEmailClaim)) }) } +}