Skip to content

Commit

Permalink
don't log userinfo cache misses
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Mar 14, 2023
1 parent 6ce4d61 commit dc2e8b7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions services/proxy/pkg/middleware/oidc_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewOIDCAuthenticator(opts ...Option) *OIDCAuthenticator {

return &OIDCAuthenticator{
Logger: options.Logger,
tokenCache: options.Cache,
userInfoCache: options.Cache,
DefaultTokenCacheTTL: options.DefaultAccessTokenTTL,
HTTPClient: options.HTTPClient,
OIDCIss: options.OIDCIss,
Expand All @@ -53,7 +53,7 @@ type OIDCAuthenticator struct {
Logger log.Logger
HTTPClient *http.Client
OIDCIss string
tokenCache store.Store
userInfoCache store.Store
DefaultTokenCacheTTL time.Duration
ProviderFunc func() (OIDCProvider, error)
AccessTokenVerifyMethod string
Expand All @@ -68,8 +68,8 @@ type OIDCAuthenticator struct {

func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[string]interface{}, error) {
var claims map[string]interface{}
record, err := m.tokenCache.Read(token)
if err != nil {
record, err := m.userInfoCache.Read(token)
if err != nil && err != store.ErrNotFound {
m.Logger.Error().Err(err).Msg("could not read from userinfo cache")
}
if len(record) > 1 {
Expand Down Expand Up @@ -104,7 +104,7 @@ func (m *OIDCAuthenticator) getClaims(token string, req *http.Request) (map[stri
if d, err := msgpack.Marshal(claims); err != nil {
m.Logger.Error().Err(err).Msg("failed to marshal claims for userinfo cache")
} else {
err = m.tokenCache.Write(&store.Record{
err = m.userInfoCache.Write(&store.Record{
Key: token,
Value: d,
Expiry: time.Until(expiration),
Expand Down

0 comments on commit dc2e8b7

Please sign in to comment.