Java Code Examples for org.springframework.security.oauth2.provider.token.store.JwtTokenStore

The following are top voted examples for showing how to use org.springframework.security.oauth2.provider.token.store.JwtTokenStore. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: xm-uaa   File: DomainTokenServicesUnitTest.java   Source Code and License 6 votes vote down vote up
@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   Source Code and License 6 votes vote down vote up
/**
 * @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: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfigurationTests.java   Source Code and License 5 votes vote down vote up
@Test
public void jwtTokenStoreShouldBeConditionalOnMissingBean() throws Exception {
	TestPropertyValues.of("security.oauth2.resource.jwt.keyValue=" + PUBLIC_KEY)
			.applyTo(this.environment);
	this.context = new SpringApplicationBuilder(JwtTokenStoreConfiguration.class,
			ResourceConfiguration.class).environment(this.environment)
					.web(WebApplicationType.NONE).run();
	assertThat(this.context.getBeansOfType(JwtTokenStore.class)).hasSize(1);
}
 
Example 4
Project: microservices-tcc-alfa   File: JwtConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@Qualifier("tokenStore")
public TokenStore tokenStore() {

    System.out.println("Created JwtTokenStore");
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 5
Project: microservices-tcc-alfa   File: JwtConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@Qualifier("tokenStore")
public TokenStore tokenStore() {

    System.out.println("Created JwtTokenStore");
    return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 6
Project: microservices-tcc-alfa   File: JwtConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@Qualifier("tokenStore")
public TokenStore tokenStore() {

    System.out.println("Created JwtTokenStore");
    return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 7
Project: spring-boot-oauth2-password-flow   File: OAuth2ServerConfiguration.java   Source Code and License 5 votes vote down vote up
@Override
public void configure(final AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    // @formatter:off
    endpoints
        .tokenStore(new JwtTokenStore(jwtAccessTokenConverter))
        .authenticationManager(authenticationManager)
        .accessTokenConverter(jwtAccessTokenConverter);
    // @formatter:on
}
 
Example 8
Project: allegro-intellij-templates   File: $ Spring OAuth2 Access Token Decoder.java   Source Code and License 5 votes vote down vote up
@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 9
Project: IDEAConfigSync   File: $ Spring OAuth2 Access Token Decoder.java   Source Code and License 5 votes vote down vote up
@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 10
Project: xm-uaa   File: UaaConfiguration.java   Source Code and License 4 votes vote down vote up
/**
 * Apply the token converter (and enhander) for token store.
 */
@Bean
public JwtTokenStore tokenStore() throws UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException,
    KeyStoreException, IOException {
    return new JwtTokenStore(jwtAccessTokenConverter());
}
 
Example 11
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(TokenStore.class)
public TokenStore jwtTokenStore() {
	return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 12
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfigurationTests.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtTokenEnhancer) {
	return new JwtTokenStore(jwtTokenEnhancer);
}
 
Example 13
Project: OMIPlatform   File: JwtSecurityConfig.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore jwtTokenStore(){
    return new JwtTokenStore(this.jwtAccessTokenConverter());
}
 
Example 14
Project: xm-ms-balance   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 15
Project: spring-authorization-server   File: JwtConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
    return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 16
Project: xm-ms-dashboard   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 17
Project: microservices-tcc-alfa   File: AuthorizationServerConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
	return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 18
Project: theskeleton   File: SecurityConfig.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter accessTokenConverter) {
	return new JwtTokenStore(accessTokenConverter);
}
 
Example 19
Project: OAuth-2.0-Cookbook   File: OAuth2AuthorizationServer.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore jwtTokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 20
Project: OAuth-2.0-Cookbook   File: OAuth2AuthorizationServerConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore jwtTokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 21
Project: OAuth-2.0-Cookbook   File: OAuth2ResourceServer.java   Source Code and License 4 votes vote down vote up
@Bean
public JweTokenStore tokenStore() {
    return new JweTokenStore(getSignKey(),
        new JwtTokenStore(jwtTokenConverter()), jwtTokenConverter(), tokenSerializer());
}
 
Example 22
Project: OAuth-2.0-Cookbook   File: OAuth2AuthorizationServer.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore jwtTokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 23
Project: OAuth-2.0-Cookbook   File: OAuth2AuthorizationServer.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore jwtTokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 24
Project: xm-gate   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 25
Project: spring-auth-example   File: OAuth2Config.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
  return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 26
Project: spring-oauth2-jwt   File: JWTConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() {
    return new JwtTokenStore(tokenEnhancer());
}
 
Example 27
Project: spring-oauth2-jwt   File: JWTConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() {
    return new JwtTokenStore(tokenEnhancer());
}
 
Example 28
Project: Using-Spring-Oauth2-to-secure-REST   File: AuthorizationConfig.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
    return new JwtTokenStore(accessTokenConverter());

}
 
Example 29
Project: Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token   File: AuthorizationServerConfig.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 30
Project: java-microservice   File: JwtServerConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
    return new JwtTokenStore(jwtTokenEnhancer());
}
 
Example 31
Project: java-microservice   File: JwtConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@Qualifier("tokenStore")
public TokenStore tokenStore() {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 32
Project: xm-ms-entity   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 33
Project: authorizer   File: JwtConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() throws FileNotFoundException {
  return new JwtTokenStore((JwtAccessTokenConverter) tokenEnhancer());
}
 
Example 34
Project: spring-boot-oauth2-password-flow   File: OAuth2ServerConfiguration.java   Source Code and License 4 votes vote down vote up
@Override
public void configure(final ResourceServerSecurityConfigurer resources) {
    resources
            .tokenStore(new JwtTokenStore(jwtAccessTokenConverter));
}
 
Example 35
Project: xm-ms-timeline   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 36
Project: tokamak   File: AuthorizationServerConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
	return new JwtTokenStore(accessTokenConverter());
}
 
Example 37
Project: xm-ms-config   File: MicroserviceSecurityConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) {
    return new JwtTokenStore(jwtAccessTokenConverter);
}
 
Example 38
Project: cloud-project   File: AuthorizationServerConfig.java   Source Code and License 4 votes vote down vote up
/**
 * 令牌存储
 * @return redis令牌存储对象
 */
@Bean
public TokenStore tokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 39
Project: webworms   File: AuthorizationServerConfiguration.java   Source Code and License 4 votes vote down vote up
/**
 * We want to use a JWT toke store here.
 *
 * @return The token store
 */
public
@Bean
TokenStore tokenStore() {
    return new JwtTokenStore(accessTokenConverter());
}
 
Example 40
Project: tcloud-microservices   File: AuthServiceApplication.java   Source Code and License 4 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() {  // Handle OAuth2 refresh JwtToken!
    return new JwtTokenStore(tokenEnhancer());
}