简体   繁体   English

如何撤销用户作为管理员用户的访问令牌和刷新令牌? 在 Oauth2 中使用 JWT 时

[英]How to revoke the access token and refresh token of the user as an admin user? while using JWT in Oauth2

How to revoke the access token and refresh token of the user as an admin user?如何撤销用户作为管理员用户的访问令牌和刷新令牌? while using JWT in Oauth2.在 Oauth2 中使用 JWT 时。 is it recommended to store token in Database ?是否建议将令牌存储在数据库中?

If you want to be able to revoke tokens, then there is no other way but to keep some data in the database.如果您希望能够撤销令牌,那么除了在数据库中保留一些数据之外别无他法。 You can either keep the concrete tokens, and mark them as revoked until they're expired, or you can keep an entry with clientID/userID and a timestamp, and do not accept tokens issued to that client/user, before the given timestamp.您可以保留具体的令牌,并将它们标记为已撤销,直到它们过期,或者您可以保留一个带有 clientID/userID 和时间戳的条目,并且在给定的时间戳之前不接受颁发给该客户端/用户的令牌。

If you want to be able to revoke access tokens, then you have to remember that all APIs, which consume that token, will have to call that database to check if the token was revoked or not.如果您希望能够撤销访问令牌,那么您必须记住,所有使用该令牌的 API 都必须调用该数据库来检查该令牌是否已被撤销。 It is usually easier to have short lived access tokens (15 or even 5 minutes), and only deal with revoking the refresh token, as the RT is only used in your Authorization Server.拥有短期访问令牌(15 甚至 5 分钟)通常更容易,并且只处理撤销刷新令牌,因为 RT 仅在您的授权服务器中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 撤销JWT Oauth2刷新令牌 - Revoke JWT Oauth2 Refresh Token Spring OAuth2 + JWT,如何将外部访问令牌映射到本地用户 - Spring OAuth2 + JWT, how to map external access token to local user 如何在Spring中使用OAuth2和JWT令牌代表特定用户调用受保护的资源? - How to call a protected resource on behalf of a specific user using OAuth2 and JWT token in Spring? 如何访问 oauth2 访问令牌和用户信息 - How to access oauth2 access token and user information 当用户使用jwt,Oauth2和spring security进行首次请求时,如何在服务层上获取jwt令牌字符串? - How to get jwt token string on service layer when user request first time using jwt, Oauth2, spring security? 春天如何在oauth2中使用刷新令牌更新访问令牌? - How to renew access token with the refresh token in oauth2 in spring? Oauth2 服务器返回“访问令牌”而不是 Jwt 令牌 - Oauth2 Server returns "Access Token" instead of Jwt Token 在Spring Security oauth2中生成令牌时获取用户详细信息 - Get the user details while generating the token in spring security oauth2 Spring安全oauth2与jwt,撤销刷新令牌 - Spring Security oauth2 with jwt, revocation of refresh token Spring Boot OAuth2:如何检索用户令牌信息详细信息 - Spring Boot OAuth2: How to retrieve user token info details
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM