We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LogoutHandler黑名单缓存时间计算不正确
func (mw *GfJWTMiddleware) setBlacklist(ctx context.Context, token string, claims jwt.MapClaims) error { // The goal of MD5 is to reduce the key length. token, err := gmd5.EncryptString(token) if err != nil { return err } exp := int64(claims["exp"].(float64)) // save duration time = (exp + max_refresh) - now duration := time.Unix(exp, 0).Add(mw.MaxRefresh).Sub(mw.TimeFunc()).Truncate(time.Second) key := mw.BlacklistPrefix + token // global gcache err = blacklist.Set(ctx, key, true, duration) if err != nil { return err } return nil }
其中exp是毫秒,在执行time.Unix的第一个参数单位是秒,就会导致算出来的时间多了3个0
于是写入数据库的缓存时间就会是292yr
The text was updated successfully, but these errors were encountered:
No branches or pull requests
LogoutHandler黑名单缓存时间计算不正确
其中exp是毫秒,在执行time.Unix的第一个参数单位是秒,就会导致算出来的时间多了3个0
于是写入数据库的缓存时间就会是292yr
The text was updated successfully, but these errors were encountered: