我正在使用 Spring 安全性设置 OAuth2.0 授权服务器。我想知道在 OAuth2.0 授权服务器启动并运行后是否有办法动态注册 OAuth2.0 客户端?
基本上,我知道我可以在配置 OAuth2.0 服务器时注册客户端,方法是扩展AuthorizationServerConfigurerAdapter
并覆盖 configure 方法以在内存中添加客户端详细信息。但是,这种方式客户端是预先注册的,我想知道如何动态添加客户端详细信息。
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
// @formatter:off
clients.inMemory()
.withClient(CLIENT_ID)
.secret(CLIENT_SECRET)
.authorizedGrantTypes("authorization_code", "implicit")
.redirectUris("http://junk/")
.scopes("cn")
.accessTokenValiditySeconds(600);
// @formatter:on
}