Java Code Examples for org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.afterPropertiesSet()

The following are Jave code examples for showing how to use afterPropertiesSet() of the org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: xm-uaa   File: DomainTokenServicesUnitTest.java   View Source Code Vote up 6 votes
@Before
public void setup() throws Exception {
    MockitoAnnotations.initMocks(this);
    JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    KeyPair keyPair = new KeyStoreKeyFactory(
        new ClassPathResource(KEYSTORE_PATH), KEYSTORE_PSWRD.toCharArray())
        .getKeyPair(KEYSTORE_ALIAS);
    converter.setKeyPair(keyPair);
    converter.afterPropertiesSet();
    tokenStore = new JwtTokenStore(converter);
    tokenServices = new DomainTokenServices();
    tokenServices.setTokenStore(tokenStore);
    tokenServices.setTokenEnhancer(converter);
    tokenServices.setTenantPropertiesService(tenantPropertiesService);
    when(tenantPropertiesService.getTenantProps()).thenReturn(tenantProperties);
    when(tenantProperties.getSecurity()).thenReturn(security);
}
 
Example 2
Project: hawkbit-extensions   File: UaaOAuthAutoConfiguration.java   View Source Code Vote up 6 votes
/**
 * @return The {@link JwtTokenStore} verifies access tokens and extract
 *         authentication and authorities from it.
 */
@Bean
public JwtTokenStore jwtTokenStore() {
    final DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
    accessTokenConverter.setUserTokenConverter(userPrincipalInfoTokenServices());
    final JwtAccessTokenConverter jwtTokenEnhancer = new JwtAccessTokenConverter();
    jwtTokenEnhancer.setAccessTokenConverter(accessTokenConverter);
    jwtTokenEnhancer.setSigningKey(uaaClientResources.getResource().getJwt().getKeyValue());
    jwtTokenEnhancer.setVerifierKey(uaaClientResources.getResource().getJwt().getKeyValue());
    try {
        jwtTokenEnhancer.afterPropertiesSet();
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
    return new JwtTokenStore(jwtTokenEnhancer);
}
 
Example 3
Project: credhub   File: OAuth2AuthConfigurationTest.java   View Source Code Vote up 5 votes
@Bean
@Primary
@Profile("OAuth2ConfigurationTest")
public JwtAccessTokenConverter symmetricTokenConverter(
    DefaultAccessTokenConverter defaultAccessTokenConverter) throws Exception {
  JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
  jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter);
  jwtAccessTokenConverter.afterPropertiesSet();
  return jwtAccessTokenConverter;
}
 
Example 4
Project: resource-server-testing   File: AuthorizationServerConfig.java   View Source Code Vote up 5 votes
@Bean
public JwtAccessTokenConverter accessTokenConverter() throws Exception {
	JwtAccessTokenConverter jwt = new JwtAccessTokenConverter();
	jwt.setSigningKey(signing);
	jwt.setVerifierKey(verifier);
	jwt.afterPropertiesSet();
	return jwt;
}
 
Example 5
Project: allegro-intellij-templates   File: $ Spring OAuth2 Access Token Decoder.java   View Source Code Vote up 5 votes
@Autowired
public $NAME(@Value("${oauth2.tokenKey}") String publicKeyUrl) throws Exception {
    String publicKey = (String) new RestTemplate().getForObject(publicKeyUrl, Map.class).get("value");

    JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
    tokenConverter.setVerifierKey(publicKey);
    tokenConverter.afterPropertiesSet();

    tokenStore = new JwtTokenStore(tokenConverter);
}
 
Example 6
Project: IDEAConfigSync   File: $ Spring OAuth2 Access Token Decoder.java   View Source Code Vote up 5 votes
@Autowired
public $NAME(@Value("${oauth2.tokenKey}") String publicKeyUrl) throws Exception {
    String publicKey = (String) new RestTemplate().getForObject(publicKeyUrl, Map.class).get("value");

    JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
    tokenConverter.setVerifierKey(publicKey);
    tokenConverter.afterPropertiesSet();

    tokenStore = new JwtTokenStore(tokenConverter);
}
 
Example 7
Project: spring-polymer-demo   File: PolymerResourceOAuthConfig.java   View Source Code Vote up 4 votes
@Bean
public JwtTokenStore tokenStore() throws Exception {
	JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
	enhancer.afterPropertiesSet();
	return new JwtTokenStore(enhancer);
}