@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;
 }
 // TODO: add own key
 @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;
 }
 @Bean
 public JwtAccessTokenConverter jwtTokenEnhancer() {
   // Implementation based on Java TrustStore. If you need something different you can
   // override and implement your own JwtAccessTokenConverter.
   // Authorization and ResourceServer implementation must be the same
   JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
   KeyPair keyPair =
       new KeyStoreKeyFactory(
               new ClassPathResource(oauthJwtKeystore), oauthJwtKeystorePassword.toCharArray())
           .getKeyPair(oauthJwtKeystoreKey);
   converter.setKeyPair(keyPair);
   return converter;
 }
 @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;
 }
 @Bean
 public JwtAccessTokenConverter accessTokenConverter() {
   final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
   // 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;
 }