Search in sources :

Example 1 with CustomTokenServices

use of org.motechproject.mots.security.token.CustomTokenServices in project mots by motech-implementations.

the class TokenConfiguration method tokenServices.

/**
 * Set-up CustomTokenServices with tokenStore().
 * @return token services
 */
@Bean
@Primary
public CustomTokenServices tokenServices() {
    TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
    tokenEnhancerChain.setTokenEnhancers(Arrays.asList(tokenEnhancer(), accessTokenConverter()));
    CustomTokenServices customTokenServices = new CustomTokenServices();
    customTokenServices.setTokenStore(tokenStore());
    customTokenServices.setTokenEnhancer(tokenEnhancerChain);
    customTokenServices.setClientDetailsService(clientDetailsService);
    customTokenServices.setSupportRefreshToken(true);
    customTokenServices.setAccessTokenValiditySeconds(tokenValiditySeconds);
    customTokenServices.setRefreshTokenValiditySeconds(tokenValiditySeconds * 2);
    customTokenServices.setReuseRefreshToken(false);
    return customTokenServices;
}
Also used : TokenEnhancerChain(org.springframework.security.oauth2.provider.token.TokenEnhancerChain) CustomTokenServices(org.motechproject.mots.security.token.CustomTokenServices) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Aggregations

CustomTokenServices (org.motechproject.mots.security.token.CustomTokenServices)1 Bean (org.springframework.context.annotation.Bean)1 Primary (org.springframework.context.annotation.Primary)1 TokenEnhancerChain (org.springframework.security.oauth2.provider.token.TokenEnhancerChain)1