Search in sources :

Example 1 with InMemoryClientDetailsServiceBuilder

use of org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder in project spring-security-oauth by spring-projects.

the class ClientDetailsServiceConfigurer method inMemory.

public InMemoryClientDetailsServiceBuilder inMemory() throws Exception {
    InMemoryClientDetailsServiceBuilder next = getBuilder().inMemory();
    setBuilder(next);
    return next;
}
Also used : InMemoryClientDetailsServiceBuilder(org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder)

Example 2 with InMemoryClientDetailsServiceBuilder

use of org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder 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 InMemoryClientDetailsServiceBuilder

use of org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder in project spring-security-oauth by spring-projects.

the class AbstractDefaultTokenServicesTests method testRefreshTokenNonExpiring.

@Test
public void testRefreshTokenNonExpiring() throws Exception {
    ClientDetailsService clientDetailsService = new InMemoryClientDetailsServiceBuilder().withClient("id").refreshTokenValiditySeconds(0).authorizedGrantTypes("refresh_token").and().build();
    DefaultTokenServices tokenServices = getTokenServices();
    tokenServices.setClientDetailsService(clientDetailsService);
    OAuth2RefreshToken refreshToken = tokenServices.createAccessToken(createAuthentication()).getRefreshToken();
    assertNotNull(refreshToken);
    assertFalse(refreshToken instanceof ExpiringOAuth2RefreshToken);
}
Also used : ExpiringOAuth2RefreshToken(org.springframework.security.oauth2.common.ExpiringOAuth2RefreshToken) OAuth2RefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken) DefaultExpiringOAuth2RefreshToken(org.springframework.security.oauth2.common.DefaultExpiringOAuth2RefreshToken) InMemoryClientDetailsServiceBuilder(org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder) ClientDetailsService(org.springframework.security.oauth2.provider.ClientDetailsService) ExpiringOAuth2RefreshToken(org.springframework.security.oauth2.common.ExpiringOAuth2RefreshToken) DefaultExpiringOAuth2RefreshToken(org.springframework.security.oauth2.common.DefaultExpiringOAuth2RefreshToken) Test(org.junit.Test)

Aggregations

InMemoryClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder)3 Before (org.junit.Before)1 Test (org.junit.Test)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