Skip to content
New issue

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

销毁令牌这一段逻辑是不是写错了 #99

Open
birdycn opened this issue Jan 20, 2021 · 2 comments
Open

销毁令牌这一段逻辑是不是写错了 #99

birdycn opened this issue Jan 20, 2021 · 2 comments

Comments

@birdycn
Copy link

birdycn commented Jan 20, 2021

	// 如果设定了存储,则将未过期的令牌放入
	return a.callStore(func(store Storer) error {
		expired := time.Unix(claims.ExpiresAt, 0).Sub(time.Now())
		return store.Set(ctx, tokenString, expired)
	})

expired=未过期时间-当前时间,重新设置store,那令牌不依旧有效吗?

@LonglyCode
Copy link
Contributor

jwt本身有过期时间,是不需要放到redis里面的。这里是将要销毁的token放到redis里面,相当于黑名单。

@birdycn
Copy link
Author

birdycn commented Jan 27, 2021

明白感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants