use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class ResourceServerSecurityConfigurer method tokenServices.
private ResourceServerTokenServices tokenServices(HttpSecurity http) {
if (resourceTokenServices != null) {
return resourceTokenServices;
}
DefaultTokenServices tokenServices = new DefaultTokenServices();
tokenServices.setTokenStore(tokenStore());
tokenServices.setSupportRefreshToken(true);
tokenServices.setClientDetailsService(clientDetails());
this.resourceTokenServices = tokenServices;
return tokenServices;
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class DefaultTokenServicesTests method testAccidentalNullAuthentication.
@Test(expected = InvalidTokenException.class)
public void testAccidentalNullAuthentication() {
Mockito.when(tokenStore.readAccessToken(Mockito.anyString())).thenReturn(new DefaultOAuth2AccessToken("FOO"));
// A bug in the TokenStore or a race condition could lead to the authentication
// being null even if the token is not:
Mockito.when(tokenStore.readAuthentication(Mockito.any(OAuth2AccessToken.class))).thenReturn(null);
services.loadAuthentication("FOO");
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class Application method tokenStore.
@Bean
public JwtTokenStore tokenStore() throws Exception {
JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
// N.B. in a real system you would have to configure the verifierKey (or use JdbcTokenStore)
enhancer.afterPropertiesSet();
return new JwtTokenStore(enhancer);
}
Aggregations