fix type for value for refresh token cache

It was set to string by mistake, proper type is token.Claims.
This commit is contained in:
Dmitry Verkhoturov
2024-03-22 04:16:29 -05:00
committed by Umputun
parent 5a781693aa
commit e0423b8683
+3 -3
View File
@@ -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}
}
@@ -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 })
}