我正在编写一个oauth2授权服务器,该服务器应支持两种身份验证。
clientId
的用户名和密码(授予密码)进行身份验证cliendId
和clientSecret
存储在数据库中的预注册应用进行身份验证我的配置如下。
@Override
public void configure(ClientDetailsServiceConfigurer configurer) throws Exception {
configurer
// registered apps
.withClientDetails(appClientDetailsService)
// user auth
.and().inMemory()
.withClient(clientId)
.secret(clientSecret)
.authorizedGrantTypes(grantType)
.scopes(scopeRead, scopeWrite)
.resourceIds(resourceIds);
}
两者都是靠自己工作的,但是如果我将它们结合在一起(and()
),则会收到错误消息:
IllegalStateException: securityBuilder cannot be null
是否可以使用ClientDetailsService
和硬编码的inMemory
客户端,还是需要将UserAuthClient添加到数据库中?
谢谢