2017-01-21 2 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

이전 게시물을 확장, 그러나 이것은 미래의 devs에 대한 답이 있어야합니다.

사용자가 로그 아웃하면 액세스 토큰이 취소되어야합니다 (?!). 이것은

tokenServices.revokeToken(tokenId); 

을 통해 수행 할 수 있습니다. http://www.baeldung.com/logout-spring-security-oauth