Spring oauth2 - 使用后删除授权码
Spring oauth2 - authorization code deleted after consumed
也许我误解了授权代码授予类型,但我认为在发出代码后 spring 将在数据库中永远保留代码 oauth_code table 直到它会被用户撤销,但代码在使用后立即被删除(第一次用它交换令牌),
这里的流程是什么 - 我的客户是否应该保留刷新令牌以便稍后(或用户离线时)获取访问令牌
规范说 return 刷新令牌是可选的,如所写
The authorization server authenticates the client, validates the
authorization code, and ensures that the redirection URI
received matches the URI used to redirect the client in
step (C). If valid, the authorization server responds back with
an access token and, optionally, a refresh token.
所以如果授权服务器决定不提供刷新令牌,客户端就无法离线请求访问令牌,他们需要重新执行授权代码过程?
谢谢
什洛米
授权码只能使用一次,而且有效期很短。如果您阅读规范的第 4.1.2 节,它会说
The authorization code MUST expire
shortly after it is issued to mitigate the risk of leaks. A
maximum authorization code lifetime of 10 minutes is
RECOMMENDED.
因此,一旦代码被使用,就没有真正的理由保留它(除了可能检测进一步使用它的尝试)。
刷新令牌允许客户端获取另一个访问令牌。否则,正如你所说,它需要重新执行授权代码流程才能从头开始获得一个,这需要资源所有者(用户)的交互。通常,系统会设置为向该客户端发出刷新令牌或不向该客户端发出刷新令牌,具体取决于它是否确实需要离线访问资源,或者资源所有者(用户)是否始终直接与其交互。
也许我误解了授权代码授予类型,但我认为在发出代码后 spring 将在数据库中永远保留代码 oauth_code table 直到它会被用户撤销,但代码在使用后立即被删除(第一次用它交换令牌),
这里的流程是什么 - 我的客户是否应该保留刷新令牌以便稍后(或用户离线时)获取访问令牌
规范说 return 刷新令牌是可选的,如所写
The authorization server authenticates the client, validates the authorization code, and ensures that the redirection URI received matches the URI used to redirect the client in step (C). If valid, the authorization server responds back with an access token and, optionally, a refresh token.
所以如果授权服务器决定不提供刷新令牌,客户端就无法离线请求访问令牌,他们需要重新执行授权代码过程?
谢谢 什洛米
授权码只能使用一次,而且有效期很短。如果您阅读规范的第 4.1.2 节,它会说
The authorization code MUST expire shortly after it is issued to mitigate the risk of leaks. A maximum authorization code lifetime of 10 minutes is RECOMMENDED.
因此,一旦代码被使用,就没有真正的理由保留它(除了可能检测进一步使用它的尝试)。
刷新令牌允许客户端获取另一个访问令牌。否则,正如你所说,它需要重新执行授权代码流程才能从头开始获得一个,这需要资源所有者(用户)的交互。通常,系统会设置为向该客户端发出刷新令牌或不向该客户端发出刷新令牌,具体取决于它是否确实需要离线访问资源,或者资源所有者(用户)是否始终直接与其交互。