Search in sources :

Example 1 with TokenEnhancerChain

use of org.springframework.security.oauth2.provider.token.TokenEnhancerChain in project paascloud-master by paascloud.

the class PcAuthorizationServerConfig method configure.

/**
 * Configure.
 *
 * @param endpoints the endpoints
 *
 * @throws Exception the exception
 */
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints.tokenStore(tokenStore).authenticationManager(authenticationManager).userDetailsService(userDetailsService);
    if (jwtAccessTokenConverter != null && jwtTokenEnhancer != null) {
        TokenEnhancerChain enhancerChain = new TokenEnhancerChain();
        List<TokenEnhancer> enhancers = new ArrayList<>();
        enhancers.add(jwtTokenEnhancer);
        enhancers.add(jwtAccessTokenConverter);
        enhancerChain.setTokenEnhancers(enhancers);
        endpoints.tokenEnhancer(enhancerChain).accessTokenConverter(jwtAccessTokenConverter);
    }
}
Also used : TokenEnhancer(org.springframework.security.oauth2.provider.token.TokenEnhancer) TokenEnhancerChain(org.springframework.security.oauth2.provider.token.TokenEnhancerChain) ArrayList(java.util.ArrayList)

Example 2 with TokenEnhancerChain

use of org.springframework.security.oauth2.provider.token.TokenEnhancerChain in project flytecnologia-api by jullierme.

the class FlyAutorizationServerConfig method configure.

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
    tokenEnhancerChain.setTokenEnhancers(Arrays.asList(tokenEnhancer(), jwtAccessTokenConverter));
    endpoints.tokenStore(tokenStore()).tokenEnhancer(tokenEnhancerChain).authenticationManager(authenticationManager).accessTokenConverter(jwtAccessTokenConverter).reuseRefreshTokens(false);
/* endpoints
                .tokenStore(tokenStore())
                .accessTokenConverter(jwtAccessTokenConverter)
                .reuseRefreshTokens(false)
                .authenticationManager(authenticationManager);*/
}
Also used : TokenEnhancerChain(org.springframework.security.oauth2.provider.token.TokenEnhancerChain)

Example 3 with TokenEnhancerChain

use of org.springframework.security.oauth2.provider.token.TokenEnhancerChain 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

TokenEnhancerChain (org.springframework.security.oauth2.provider.token.TokenEnhancerChain)3 ArrayList (java.util.ArrayList)1 CustomTokenServices (org.motechproject.mots.security.token.CustomTokenServices)1 Bean (org.springframework.context.annotation.Bean)1 Primary (org.springframework.context.annotation.Primary)1 TokenEnhancer (org.springframework.security.oauth2.provider.token.TokenEnhancer)1