Grails 防止对同一用户但多个设备使用OAuth2进行登录请求

Grails 防止对同一用户但多个设备使用OAuth2进行登录请求,grails,oauth,spring-security,oauth-2.0,spring-security-oauth2,Grails,Oauth,Spring Security,Oauth 2.0,Spring Security Oauth2,我们正在使用Grails和OAuth2插件,但这是一个更一般的OAuth2问题 我们正试图解决一个问题,即同一用户使用多台设备,如果没有必要,我们不想提示输入他们的用户/密码。以以下为例: Device 1: 1. Refresh, new AT 4. Bad AT 5. Refresh, new AT… Repeats every request Device 2: 2. Bad AT 3. Refresh, new AT AT=访问令牌 RT=刷新令牌 (假设可以使用密码授权类型获得

我们正在使用Grails和OAuth2插件,但这是一个更一般的OAuth2问题

我们正试图解决一个问题,即同一用户使用多台设备,如果没有必要,我们不想提示输入他们的用户/密码。以以下为例:

Device 1:
1. Refresh, new AT
4. Bad AT
5. Refresh, new AT… Repeats every request

Device 2:
2. Bad AT
3. Refresh, new AT
  • AT=访问令牌
  • RT=刷新令牌
(假设可以使用密码授权类型获得初始ATs,并且两台设备在相同的时间获得相同的ATs)

显然,我们不想缓存密码,并且当我们有刷新令牌时,不需要提示用户。有一个标志可以重用刷新令牌,但如果我们这样做,我们最终会生成新的访问令牌,例如:

Device 1:
1. Refresh, new AT
4. Bad AT
5. Refresh, new AT… Repeats every request

Device 2:
2. Bad AT
3. Refresh, new AT

我想我们不是第一个遇到这种问题的人,所以我想我应该寻求一些想法/建议。

在我看来,您的两台设备需要获得不同的访问令牌和刷新令牌。授予的不同令牌的数量取决于
TokenStore
实现,因此这可能是您应该集中精力的地方。也许您可以使用自定义的
AuthenticationKeyGenerator
来确保两台设备获得不同的令牌?还是使用JWT