implement backchannel logout, reuse useringo cache
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
committed by
Christian Richter
parent
a900d0ed8d
commit
dc399a61ac
@@ -31,7 +31,6 @@ func NewOIDCAuthenticator(opts ...Option) *OIDCAuthenticator {
|
||||
return &OIDCAuthenticator{
|
||||
Logger: options.Logger,
|
||||
userInfoCache: options.UserInfoCache,
|
||||
sessionLookupCache: options.SessionLookupCache,
|
||||
DefaultTokenCacheTTL: options.DefaultAccessTokenTTL,
|
||||
HTTPClient: options.HTTPClient,
|
||||
OIDCIss: options.OIDCIss,
|
||||
@@ -46,7 +45,6 @@ type OIDCAuthenticator struct {
|
||||
HTTPClient *http.Client
|
||||
OIDCIss string
|
||||
userInfoCache store.Store
|
||||
sessionLookupCache store.Store
|
||||
DefaultTokenCacheTTL time.Duration
|
||||
oidcClient oidc.OIDCProvider
|
||||
AccessTokenVerifyMethod string
|
||||
@@ -108,7 +106,8 @@ func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[stri
|
||||
}
|
||||
|
||||
if sid, ok := claims["sid"]; ok {
|
||||
err = m.sessionLookupCache.Write(&store.Record{
|
||||
// reuse user cache for session id lookup
|
||||
err = m.userInfoCache.Write(&store.Record{
|
||||
Key: fmt.Sprintf("%s", sid),
|
||||
Value: []byte(encodedHash),
|
||||
Expiry: time.Until(expiration),
|
||||
|
||||
@@ -56,8 +56,6 @@ type Options struct {
|
||||
DefaultAccessTokenTTL time.Duration
|
||||
// UserInfoCache sets the access token cache store
|
||||
UserInfoCache store.Store
|
||||
// SessionLookupCache maps the session to a hashed jwt token
|
||||
SessionLookupCache store.Store
|
||||
// CredentialsByUserAgent sets the auth challenges on a per user-agent basis
|
||||
CredentialsByUserAgent map[string]string
|
||||
// AccessTokenVerifyMethod configures how access_tokens should be verified but the oidc_auth middleware.
|
||||
@@ -200,13 +198,6 @@ func UserInfoCache(val store.Store) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// SessionLookupCache provides a function to set the SessionLookupCache
|
||||
func SessionLookupCache(val store.Store) Option {
|
||||
return func(o *Options) {
|
||||
o.SessionLookupCache = val
|
||||
}
|
||||
}
|
||||
|
||||
// UserProvider sets the accounts user provider
|
||||
func UserProvider(up backend.UserBackend) Option {
|
||||
return func(o *Options) {
|
||||
|
||||
Reference in New Issue
Block a user