【发布时间】:2020-04-19 16:33:47
【问题描述】:
在spring security oauth2中,获取访问令牌和刷新令牌使用同一个端点'/oauth/token',并通过参数grant_type'code'或'refresh_token'识别。
if (isAuthCodeRequest(parameters)) {
// The scope was requested or determined during the authorization step
if (!tokenRequest.getScope().isEmpty()) {
logger.debug("Clearing scope of incoming token request");
tokenRequest.setScope(Collections.<String> emptySet());
}
}
if (isRefreshTokenRequest(parameters)) {
// A refresh token has its own default scopes, so we should ignore any added by the factory here.
tokenRequest.setScope(OAuth2Utils.parseParameterList(parameters.get(OAuth2Utils.SCOPE)));
}
但我想将此端点分成两部分,例如用于获取访问令牌的“oauth/access_token”和用于刷新访问令牌的“oauth/refresh_token”。我该怎么做 ?
我尝试编写自定义端点类,并注册 bean 以覆盖默认的 TokenEndpoint ,但似乎效果不佳。
【问题讨论】:
标签: java spring oauth-2.0 spring-security-oauth2