gaodm hace 5 años
padre
commit
c295159919
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      src/main/java/com/diagbot/config/JwtConfigurer.java

+ 3 - 0
src/main/java/com/diagbot/config/JwtConfigurer.java

@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
 import org.springframework.security.oauth2.provider.token.TokenStore;
 import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
 import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
@@ -42,6 +43,8 @@ public class JwtConfigurer {
             throw new RuntimeException(e);
         }
         converter.setVerifierKey(publicKey);
+        //不设置这个会出现 Cannot convert access token to JSON
+        converter.setVerifier(new RsaVerifier(publicKey));
         converter.setAccessTokenConverter(customAccessTokenConverter);
         return converter;
     }