gaodm 5 年 前
コミット
c295159919
1 ファイル変更3 行追加0 行削除
  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;
     }