MrBird 6 lat temu
rodzic
commit
f3eccc17ac

+ 6 - 2
febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/FebsUtil.java

@@ -312,8 +312,12 @@ public class FebsUtil {
      * @return String 令牌内容
      */
     public static String getCurrentTokenValue() {
-        OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) getOauth2Authentication().getDetails();
-        return details == null ? null : details.getTokenValue();
+        try {
+            OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) getOauth2Authentication().getDetails();
+            return details.getTokenValue();
+        } catch (Exception ignore) {
+            return null;
+        }
     }
 
     public static void printSystemUpBanner(Environment environment) {