Skip to content

Commit

Permalink
fix type for value for refresh token cache
Browse files Browse the repository at this point in the history
It was set to string by mistake, proper type is token.Claims.
  • Loading branch information
paskal authored and umputun committed Mar 22, 2024
1 parent 5a78169 commit e0423b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/app/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,11 +1327,11 @@ func splitAtCommas(s string) []string {

// authRefreshCache used by authenticator to minimize repeatable token refreshes
type authRefreshCache struct {
cache.LoadingCache[string]
cache.LoadingCache[token.Claims]
}

func newAuthRefreshCache() *authRefreshCache {
o := cache.NewOpts[string]()
o := cache.NewOpts[token.Claims]()
expirableCache, _ := cache.NewExpirableCache(o.TTL(5 * time.Minute))
return &authRefreshCache{LoadingCache: expirableCache}
}
Expand All @@ -1343,5 +1343,5 @@ func (c *authRefreshCache) Get(key interface{}) (interface{}, bool) {

// Set implements cache setter with key converted to string
func (c *authRefreshCache) Set(key, value interface{}) {
_, _ = c.LoadingCache.Get(key.(string), func() (string, error) { return value.(string), nil })
_, _ = c.LoadingCache.Get(key.(string), func() (token.Claims, error) { return value.(token.Claims), nil })
}

0 comments on commit e0423b8

Please sign in to comment.