2017-01-21 4 views
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 { 

} 

}

答えて

0

古いポストを拡張するが、これは将来の開発者のための答えを持っている必要があります。

ユーザーがログアウトすると、アクセストークンを取り消す必要がありますか?これは、

tokenServices.revokeToken(tokenId); 

によって実行できます。 http://www.baeldung.com/logout-spring-security-oauth

関連する問題