Search in sources :

Example 1 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project spring-boot by spring-projects.

the class ResourceServerTokenServicesConfigurationTests method asymmetricJwt.

@Test
public void asymmetricJwt() {
    EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY);
    this.context = new SpringApplicationBuilder(ResourceConfiguration.class).environment(this.environment).web(WebApplicationType.NONE).run();
    DefaultTokenServices services = this.context.getBean(DefaultTokenServices.class);
    assertThat(services).isNotNull();
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices) Test(org.junit.Test)

Example 2 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project spring-security-oauth by spring-projects.

the class TokenServicesWithTokenEnhancerTests method init.

@Before
public void init() throws Exception {
    tokenServices = new DefaultTokenServices();
    tokenServices.setClientDetailsService(new InMemoryClientDetailsServiceBuilder().withClient("client").authorizedGrantTypes(new String[] { "authorization_code", "refresh_token" }).scopes("read").secret("secret").and().build());
    enhancer.setTokenEnhancers(Arrays.<TokenEnhancer>asList(jwtTokenEnhancer));
    jwtTokenEnhancer.afterPropertiesSet();
    tokenServices.setTokenStore(new JwtTokenStore(jwtTokenEnhancer));
    tokenServices.setTokenEnhancer(enhancer);
}
Also used : JwtTokenStore(org.springframework.security.oauth2.provider.token.store.JwtTokenStore) InMemoryClientDetailsServiceBuilder(org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder) Before(org.junit.Before)

Example 3 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project theskeleton by codenergic.

the class OAuth2ResourceServerConfig method configure.

@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
    DefaultTokenServices tokenServices = new DefaultTokenServices();
    tokenServices.setAuthenticationManager(authenticationManager);
    tokenServices.setTokenStore(tokenStore);
    resources.tokenServices(tokenServices);
}
Also used : DefaultTokenServices(org.springframework.security.oauth2.provider.token.DefaultTokenServices)

Example 4 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project faf-java-server by FAForever.

the class OAuthJwtConfig method tokenServices.

@Bean
@Primary
public DefaultTokenServices tokenServices(TokenStore tokenStore) {
    DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore);
    defaultTokenServices.setSupportRefreshToken(true);
    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 5 with DefaultTokenServices

use of org.springframework.security.oauth2.provider.token.DefaultTokenServices in project FP-PSP-SERVER by FundacionParaguaya.

the class AuthServerOAuth2Config method defaultTokenServices.

@Bean
@Primary
public DefaultTokenServices defaultTokenServices() {
    final DefaultTokenServices defaultTokenServices = new DefaultTokenServices();
    defaultTokenServices.setTokenStore(tokenStore());
    defaultTokenServices.setTokenEnhancer(tokenEnhancer());
    defaultTokenServices.setSupportRefreshToken(true);
    defaultTokenServices.setClientDetailsService(clientDetailsService());
    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