【发布时间】:2016-06-13 15:21:12
【问题描述】:
我有 Spring OAuth 授权服务器,我想添加对多个客户端 (id) 的支持。我这样配置客户端:
clients
.inMemory().withClient(client).secret(clientSecret)
.resourceIds(resourceId)
.authorizedGrantTypes("client_credentials", "password", "refresh_token", "implicit", "authorization_code")
.authorities("ROLE_USER")
.scopes("read", "write")
.autoApprove(true)
.and()
.inMemory().withClient("acme").secret("acmesecret")
.resourceIds(resourceId)
.authorizedGrantTypes("client_credentials", "password", "refresh_token", "implicit", "authorization_code")
.authorities("ROLE_USER_ACME")
.scopes("read", "write")
.autoApprove(true);
我可以使用第一个客户端获取访问令牌,但尝试使用第二个客户端获取访问令牌时出现此错误:
{
"timestamp": 1456822249638,
"status": 401,
"error": "Unauthorized",
"message": "Bad credentials",
"path": "/oauth/token"
}
是否可以添加多个客户端以及如何添加?另外,如何从数据库中读取客户端?
【问题讨论】:
标签: java spring spring-security oauth-2.0 spring-security-oauth2