Fixing format for v7.5.0

This commit is contained in:
Leandro Lafin 2024-07-11 17:56:20 -03:00
parent ad81d2f8fb
commit e645994bbe
No known key found for this signature in database
GPG Key ID: 60C427B9DF40CB72
16 changed files with 23 additions and 22 deletions

View File

@ -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(),

View File

@ -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. /<oauth2>/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])")

View File

@ -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")

View File

@ -1,7 +1,7 @@
package cookie
import (
"context"
"context"
"errors"
"fmt"
"net/http"

View File

@ -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
}

View File

@ -1,7 +1,7 @@
package persistence
import (
"context"
"context"
"fmt"
"net/http"
"time"

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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())
})

View File

@ -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 == "" {

View File

@ -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,
})

View File

@ -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

View File

@ -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"
}

View File

@ -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))
})
}
}