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

The following are top voted examples for showing how to use org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter. 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: UaaConfiguration.java   View source code 6 votes vote down vote up
/**
 * This bean generates an token enhancer, which manages the exchange between JWT acces tokens and Authentication
 * in both directions.
 *
 * @return an access token converter configured with the authorization server's public/private keys
 */
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter()
    throws IOException, KeyStoreException, CertificateException,
    NoSuchAlgorithmException, UnrecoverableKeyException {
    DomainJwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();

    InputStream stream = new ClassPathResource(Constants.KEYSTORE_FILE).getInputStream();
    KeyStore store = KeyStore.getInstance(Constants.KEYSTOPE_TYPE);

    store.load(stream, "password".toCharArray());
    PrivateKey privateKey = (PrivateKey)store.getKey("selfsigned", "password".toCharArray());

    PublicKey publicKey = getKeyFromConfigServer(keyUriRestTemplate);

    KeyPair keyPair = new KeyPair(publicKey, privateKey);
    converter.setKeyPair(keyPair);
    return converter;
}
 
Example 2
Project: xm-uaa   File: DomainTokenServicesUnitTest.java   View source code 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 3
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfiguration.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	String keyValue = this.resource.getJwt().getKeyValue();
	if (!StringUtils.hasText(keyValue)) {
		keyValue = getKeyFromServer();
	}
	if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
		converter.setSigningKey(keyValue);
	}
	if (keyValue != null) {
		converter.setVerifierKey(keyValue);
	}
	if (!CollectionUtils.isEmpty(this.configurers)) {
		AnnotationAwareOrderComparator.sort(this.configurers);
		for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
			configurer.configure(converter);
		}
	}
	return converter;
}
 
Example 4
Project: microservices-tcc-alfa   File: JwtConfiguration.java   View source code 6 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter =  new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 5
Project: OAuth-2.0-Cookbook   File: OAuth2AuthorizationServer.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();

    try {
        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
        SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
        keyGen.initialize(1024, random);

        KeyPair keyPair = keyGen.generateKeyPair();
        converter.setKeyPair(keyPair);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    return converter;
}
 
Example 6
Project: cloud-project   File: AuthorizationServerConfig.java   View source code 6 votes vote down vote up
/**
 * Jwt资源令牌转换器
 * @return accessTokenConverter
 */
@Bean
public JwtAccessTokenConverter accessTokenConverter(){
    return new JwtAccessTokenConverter(){

        /**
         * 重写增强token的方法
         * @param accessToken 资源令牌
         * @param authentication 认证
         * @return 增强的OAuth2AccessToken对象
         */
        @Override
        public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {

            String userName = authentication.getUserAuthentication().getName();
            User user = (User) authentication.getUserAuthentication().getPrincipal();
            Map<String,Object> infoMap = new HashMap<>();
            infoMap.put("userName",userName);
            infoMap.put("roles",user.getAuthorities());
            ((DefaultOAuth2AccessToken)accessToken).setAdditionalInformation(infoMap);
            return super.enhance(accessToken, authentication);
        }
    };
}
 
Example 7
Project: hawkbit-extensions   File: UaaOAuthAutoConfiguration.java   View source code 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 8
Project: spring-security-oauth   File: OAuth2ResourceServerConfig3.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey("123");
    converter.setJwtClaimsSetVerifier(jwtClaimsSetVerifier());
    return converter;
}
 
Example 9
Project: spring-security-oauth   File: OAuth2ResourceServerConfigJwt.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setAccessTokenConverter(customAccessTokenConverter);

    // converter.setSigningKey("123");
    final Resource resource = new ClassPathResource("public.txt");
    String publicKey = null;
    try {
        publicKey = IOUtils.toString(resource.getInputStream());
    } catch (final IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 10
Project: spring-security-oauth   File: OAuth2ResourceServerConfig.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey("123");
    converter.setJwtClaimsSetVerifier(jwtClaimsSetVerifier());

    // final Resource resource = new ClassPathResource("public.txt");
    // String publicKey = null;
    // try {
    // publicKey = IOUtils.toString(resource.getInputStream());
    // } catch (final IOException e) {
    // throw new RuntimeException(e);
    // }
    // converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 11
Project: contestparser   File: ResourceServerTokenServicesConfiguration.java   View source code 6 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	String keyValue = this.resource.getJwt().getKeyValue();
	if (!StringUtils.hasText(keyValue)) {
		try {
			keyValue = getKeyFromServer();
		}
		catch (ResourceAccessException ex) {
			logger.warn("Failed to fetch token key (you may need to refresh "
					+ "when the auth server is back)");
		}
	}
	if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
		converter.setSigningKey(keyValue);
	}
	if (keyValue != null) {
		converter.setVerifierKey(keyValue);
	}
	AnnotationAwareOrderComparator.sort(this.configurers);
	for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
		configurer.configure(converter);
	}
	return converter;
}
 
Example 12
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfigurationTests.java   View source code 5 votes vote down vote up
@Test
public void jwtAccessTokenConverterIsConfiguredWhenKeyUriIsProvided() {
	TestPropertyValues
			.of("security.oauth2.resource.jwt.key-uri=http://localhost:12345/banana")
			.applyTo(this.environment);
	this.context = new SpringApplicationBuilder(ResourceConfiguration.class,
			JwtAccessTokenConverterRestTemplateCustomizerConfiguration.class)
					.environment(this.environment).web(WebApplicationType.NONE).run();
	assertThat(this.context.getBeansOfType(JwtAccessTokenConverter.class)).hasSize(1);
}
 
Example 13
Project: xm-ms-balance   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromAuthorizationServer(keyUriRestTemplate));
    return converter;
}
 
Example 14
Project: spring-authorization-server   File: JwtConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();

    KeyPair keyPair = new KeyStoreKeyFactory(
            new ClassPathResource("keystore.jks"), "secret".toCharArray())
            .getKeyPair("test");
    jwtAccessTokenConverter.setKeyPair(keyPair);

    DefaultAccessTokenConverter defaultAccessTokenConverter = new DefaultAccessTokenConverter();
    defaultAccessTokenConverter.setUserTokenConverter(userAuthenticationConverter());
    jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter);
    return jwtAccessTokenConverter;
}
 
Example 15
Project: xm-ms-dashboard   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    DomainJwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
Example 16
Project: microservices-tcc-alfa   File: AuthorizationServerConfiguration.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwt.jks"), "sales123".toCharArray());
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
    return converter;
}
 
Example 17
Project: microservices-tcc-alfa   File: JwtConfiguration.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter =  new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 18
Project: microservices-tcc-alfa   File: JwtConfiguration.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter =  new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 19
Project: theskeleton   File: SecurityConfig.java   View source code 5 votes vote down vote up
/**
 * Token converter and enhancer
 * @return
 */
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(AccessTokenConverter accessTokenConverter) {
	JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
	tokenConverter.setAccessTokenConverter(accessTokenConverter);
	return tokenConverter;
}
 
Example 20
Project: OAuth-2.0-Cookbook   File: OAuth2ResourceServer.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifier(verifier());
    converter.setSigningKey("non-prod");
    return converter;
}
 
Example 21
Project: OAuth-2.0-Cookbook   File: JweTokenStore.java   View source code 5 votes vote down vote up
public JweTokenStore(String encodedSigningKey, TokenStore delegate,
                     JwtAccessTokenConverter converter, JweTokenSerializer crypto) {
    this.encodedSigningKey = encodedSigningKey;
    this.delegate = delegate;
    this.converter = converter;
    this.crypto = crypto;
}
 
Example 22
Project: initiatives_backend_auth   File: AuthServerConfiguration.java   View source code 5 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    JwtAccessTokenConverter jwtAccessTokenConverter = jwtAccessTokenConverter();
    endpoints
            .accessTokenConverter(jwtAccessTokenConverter)
            .authenticationManager(authenticationManager);
}
 
Example 23
Project: xm-gate   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
Example 24
Project: spring-auth-example   File: OAuth2Config.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
  KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
      new ClassPathResource("jwt.jks"), "mySecretKey".toCharArray());
  JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
  converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
  return converter;
}
 
Example 25
Project: spring-oauth2-jwt   File: JWTConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter tokenEnhancer() {
    JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
    jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter());

    jwtAccessTokenConverter.setSigningKey("123");

    return jwtAccessTokenConverter;
}
 
Example 26
Project: spring-oauth2-jwt   File: JWTConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter tokenEnhancer(){
    JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
    jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter());
    jwtAccessTokenConverter.setSigningKey("123");
    return jwtAccessTokenConverter;
}
 
Example 27
Project: Using-Spring-Oauth2-to-secure-REST   File: AuthorizationConfig.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    KeyStoreKeyFactory keyStoreKeyFactory =
            new KeyStoreKeyFactory(
                    new ClassPathResource("mykeys.jks"),
                    "mypass".toCharArray());
    converter.setKeyPair(keyStoreKeyFactory.getKeyPair("mykeys"));
    return converter;
}
 
Example 28
Project: Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token   File: AuthorizationServerConfig.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    try {
        converter.setSigningKey(keyProvider.getKey());
    } catch (URISyntaxException | KeyStoreException | NoSuchAlgorithmException | IOException | UnrecoverableKeyException | CertificateException e) {
        e.printStackTrace();
    }

    return converter;
}
 
Example 29
Project: java-microservice   File: JwtServerConfiguration.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
            new ClassPathResource("jwt.jks"), 
            ENC_PASSWORD.toCharArray()
    );
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
    return converter;
}
 
Example 30
Project: java-microservice   File: JwtConfiguration.java   View source code 5 votes vote down vote up
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 31
Project: microservices-basics-spring-boot   File: OAuthServerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	//Keypair is the alias name -> anilkeystore.jks / password / anila
	KeyPair keyPair = new KeyStoreKeyFactory(new ClassPathResource("anilkeystore.jks"), "password".toCharArray())
			.getKeyPair("anila");
	converter.setKeyPair(keyPair);
	return converter;
}
 
Example 32
Project: xm-ms-entity   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    DomainJwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
Example 33
Project: authorizer   File: JwtConfiguration.java   View source code 5 votes vote down vote up
@Bean
public TokenEnhancer tokenEnhancer() throws FileNotFoundException {
  Resource fr = validateJwtConfiguration();
  KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(fr, jwtSecret.toCharArray());
  JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
  converter.setKeyPair(keyStoreKeyFactory.getKeyPair(jwtAlias));
  return converter;
}
 
Example 34
Project: cloud   File: AuthorizationServerConfig.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {//TODO 重新胜场jks替换
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	KeyPair keyPair = new KeyStoreKeyFactory(
			new ClassPathResource("keystore.jks"), "foobar".toCharArray())
			.getKeyPair("test");
	converter.setKeyPair(keyPair);
	return converter;
}
 
Example 35
Project: xm-ms-timeline   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
Example 36
Project: tokamak   File: AuthorizationServerConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	converter.setSigningKey(privateKey);
	converter.setVerifierKey(publicKey);
	converter.setAccessTokenConverter(tokenConverter);
	return converter;
}
 
Example 37
Project: xm-ms-config   File: MicroserviceSecurityConfiguration.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(TokenKeyService tokenKeyService)
        throws CertificateException {
    DomainJwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(tokenKeyService));
    return converter;
}
 
Example 38
Project: Spring-Security-Third-Edition   File: OAuth2AuthorizationServerConfig.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    KeyPair keyPair = new KeyStoreKeyFactory(
            new ClassPathResource(keystore),
            keyStorePass.toCharArray()
    ).getKeyPair(keyPairAlias);

    converter.setKeyPair(keyPair);
    return converter;
}
 
Example 39
Project: Spring-Security-Third-Edition   File: OAuth2AuthorizationServerConfig.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    KeyPair keyPair = new KeyStoreKeyFactory(
            new ClassPathResource("keys/jwtConverterStore.jks"),
            keyStorePass.toCharArray()
    ).getKeyPair(keyPairAlias);

    converter.setKeyPair(keyPair);
    return converter;
}
 
Example 40
Project: trueyes   File: AuthorizationServer.java   View source code 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	KeyPair keyPair = new KeyStoreKeyFactory(new ClassPathResource("keystore.jks"), "foobar".toCharArray())
			.getKeyPair("test");
	converter.setKeyPair(keyPair);
	return converter;
}