实现了 Spring OAuth2 安全性,并在使用同一用户但从不同设备登录时获得相同的访问 token 。当我从这些设备中的任何一个注销(撤销 token )时,其他设备也被注销。这是预期的行为还是我遗漏了什么?希望共享大量代码不会有太大帮助,因此请保持问题简短。
最佳答案
The default behaviour of the DefaultTokenServices is to re-use existing tokens (based on the behaviour of the existing TokenStore implementations)
http://forum.spring.io/forum/spring-projects/security/oauth/121797-multiple-valid-oauth-access-tokens-for-same-client
如果您希望为每个设备提供不同的
access_token
,则创建您自己的 AuthenticationKeyGenerator
,例如在授权过程中发送您的设备 ID,让您的 AuthenticationKeyGenerator
处理该设备 ID 以创建特定于该设备的 access_token
。
关于spring - 实现 Spring OAuth2,从不同设备获取相同的访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32460082/