1
私は認可サーバーでJDBCトークンストアを使用しましたが、コンシューマトークンサービスについてはわかりません。誰か私に説明できますか?コンシューマトークンサービスを使用してアクセストークンを呼び出す方法は?
認証Cofigスプリングブートoauth2でコンシューマトークンサービスを使用するとは何ですか?
@Configuration
@EnableAuthorizationServer パブリッククラスOAuthServerConfigはAuthorizationServerConfigurerAdapter {
@Autowired
private UserDetailsServiceImpl userDetailsService;
@Autowired
AuthenticationManager authenticationManager;
@Autowired
Environment environment;
@Autowired
@Qualifier("dataSourceApi")
DataSource dataSource;
@Primary
@Bean
public ConsumerTokenServices defaultTokenServices() {
DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
defaultTokenServices.setTokenStore(tokenStore());
return defaultTokenServices;
}
@Bean
public JdbcTokenStore tokenStore() {
return new JdbcTokenStore(dataSource);
}
@Bean
public JdbcClientDetailsService jdbcClientDetailsService() {
return new JdbcClientDetailsService(dataSource);
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore()).authenticationManager(authenticationManager);
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.jdbc(dataSource);
}
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
}
}