Search in sources :

Example 6 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project irida by phac-nml.

the class IridaWebSecurityConfig method tokenServices.

@Bean
@Primary
public ResourceServerTokenServices tokenServices(@Qualifier("clientDetails") ClientDetailsService clientDetails, @Qualifier("iridaTokenStore") TokenStore tokenStore) {
    DefaultTokenServices services = new DefaultTokenServices();
    services.setTokenStore(tokenStore);
    services.setSupportRefreshToken(true);
    services.setClientDetailsService(clientDetails);
    return services;
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Primary(org.springframework.context.annotation.Primary) GenericFilterBean(org.springframework.web.filter.GenericFilterBean) Bean(org.springframework.context.annotation.Bean)

Example 7 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project credhub by cloudfoundry-incubator.

the class OAuth2Configuration method resourceServerTokenServices.

@Bean
public ResourceServerTokenServices resourceServerTokenServices(JwkTokenStore tokenStore) {
    DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore);
    return defaultTokenServices;
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Bean(org.springframework.context.annotation.Bean)

Example 8 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project credhub by cloudfoundry-incubator.

the class Oauth2TestConfiguration method resourceServerTokenServices.

@Bean
public ResourceServerTokenServices resourceServerTokenServices(TokenStore tokenStore) {
    DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore);
    return defaultTokenServices;
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Bean(org.springframework.context.annotation.Bean)

Example 9 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project cloud-sea-towerman by huadahuang1983.

the class OAuthServerConfig method tokenServices.

@Primary
@Bean
public AuthorizationServerTokenServices tokenServices() {
    DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore());
    defaultTokenServices.setSupportRefreshToken(true);
    defaultTokenServices.setClientDetailsService(clientDetailsService());
    // 有效期设置
    defaultTokenServices.setAccessTokenValiditySeconds((int) TimeUnit.HOURS.toSeconds(2));
    return defaultTokenServices;
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Example 10 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project new-cloud by xie-summer.

the class ResourceServerConfiguration method tokenServices.

@Bean
@Primary
public DefaultTokenServices tokenServices() {
    final DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore());
    defaultTokenServices.setTokenEnhancer(accessTokenConverter());
    return defaultTokenServices;
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Aggregations

DefaultTokenServices (org.springframework.security.oauth2.provider.token.DefaultTokenServices)14 Bean (org.springframework.context.annotation.Bean)8 Primary (org.springframework.context.annotation.Primary)6 Test (org.junit.Test)4 SpringApplicationBuilder (org.springframework.boot.builder.SpringApplicationBuilder)3 InMemoryClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder)2 Before (org.junit.Before)1 DefaultExpiringOAuth2RefreshToken (org.springframework.security.oauth2.common.DefaultExpiringOAuth2RefreshToken)1 ExpiringOAuth2RefreshToken (org.springframework.security.oauth2.common.ExpiringOAuth2RefreshToken)1 OAuth2RefreshToken (org.springframework.security.oauth2.common.OAuth2RefreshToken)1 ClientDetailsService (org.springframework.security.oauth2.provider.ClientDetailsService)1 JwtTokenStore (org.springframework.security.oauth2.provider.token.store.JwtTokenStore)1 GenericFilterBean (org.springframework.web.filter.GenericFilterBean)1