Search in sources :

Example 16 with DefaultTokenServices

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

the class ResourceServerTokenServicesConfigurationTests method switchToJwt.

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

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