org.springframework.security.oauth2.provider.token.store.jwk.JwkTokenStore Java Examples

The following examples show how to use org.springframework.security.oauth2.provider.token.store.jwk.JwkTokenStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OauthConfig.java    From entref-spring-boot with MIT License 5 votes vote down vote up
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
    // setup the resource id
    resources.resourceId(this.env.getProperty(Constants.ENV_OAUTH_RES_ID));

    // setup the token store
    resources.tokenStore(new JwkTokenStore(this.env.getProperty(Constants.ENV_OAUTH_KEYSET_URI)));
}
 
Example #2
Source File: ResourceServerTokenServicesConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void jwkTokenStoreShouldBeConditionalOnMissingBean() throws Exception {
	TestPropertyValues.of("security.oauth2.resource.jwk.key-set-uri=https://idp.example.com/token_keys")
			.applyTo(this.environment);
	this.context = new SpringApplicationBuilder(JwkTokenStoreConfiguration.class, ResourceConfiguration.class)
			.environment(this.environment).web(WebApplicationType.NONE).run();
	assertThat(this.context.getBeansOfType(JwkTokenStore.class)).hasSize(1);
}
 
Example #3
Source File: IssuerCheckConfiguration.java    From spring-cloud-sso-connector with Apache License 2.0 5 votes vote down vote up
@Bean
public TokenStore jwkTokenStore() throws MalformedURLException {
    ProviderDiscoveryClient discoveryClient = new ProviderDiscoveryClient(ssoServiceUrl);
    ProviderConfiguration providerConfiguration = discoveryClient.discover();

    IssuerClaimVerifier issuerClaimVerifier = new IssuerClaimVerifier(providerConfiguration.getIssuer());

    return new JwkTokenStore(
        keySetUri,
        issuerClaimVerifier
    );
}
 
Example #4
Source File: SecurityConfig.java    From codenjoy with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public TokenStore tokenStore() {
    JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();
    DefaultAccessTokenConverter tokenConverter = new DefaultAccessTokenConverter();
    tokenConverter.setUserTokenConverter(oAuth2UserAuthenticationConverter);
    accessTokenConverter.setAccessTokenConverter(tokenConverter);

    return new JwkTokenStore(clientProperties.getProvider().get("dojo").getJwkSetUri(),
            accessTokenConverter);
}
 
Example #5
Source File: RestApiSecurityConfig.java    From camunda-bpm-identity-keycloak with Apache License 2.0 4 votes vote down vote up
/**
 * Configures the JWKS bases TokenStore.
 */
@Bean
public TokenStore tokenStore() {
	return new JwkTokenStore(configProps.getJwkSetUrl());
}
 
Example #6
Source File: ResourceServerTokenServicesConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(TokenStore.class)
public TokenStore jwkTokenStore() {
	return new JwkTokenStore(this.resource.getJwk().getKeySetUri());
}
 
Example #7
Source File: ResourceServerTokenServicesConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 4 votes vote down vote up
@Bean
public TokenStore tokenStore() {
	return new JwkTokenStore("https://idp.example.com/token_keys");
}