Search in sources :

Example 16 with JwtTokenStore

use of org.springframework.security.oauth2.provider.token.store.JwtTokenStore in project Spring-5.0-By-Example by PacktPublishing.

the class OAuthTokenConfiguration method tokenStore.

@Bean
public JwtTokenStore tokenStore() throws Exception {
    JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
    enhancer.setSigningKey(privateKey);
    enhancer.setVerifierKey(publicKey);
    enhancer.afterPropertiesSet();
    return new JwtTokenStore(enhancer);
}
Also used : JwtTokenStore(org.springframework.security.oauth2.provider.token.store.JwtTokenStore) JwtAccessTokenConverter(org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter) Bean(org.springframework.context.annotation.Bean)

Aggregations

JwtTokenStore (org.springframework.security.oauth2.provider.token.store.JwtTokenStore)16 Bean (org.springframework.context.annotation.Bean)8 JwtAccessTokenConverter (org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter)8 Field (java.lang.reflect.Field)6 Test (org.junit.Test)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 OAuth2AccessToken (org.springframework.security.oauth2.common.OAuth2AccessToken)4 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 SignatureVerifier (org.springframework.security.jwt.crypto.sign.SignatureVerifier)1 InMemoryClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders.InMemoryClientDetailsServiceBuilder)1 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)1 AccessTokenConverter (org.springframework.security.oauth2.provider.token.AccessTokenConverter)1 JwtClaimsSetVerifier (org.springframework.security.oauth2.provider.token.store.JwtClaimsSetVerifier)1