Explorar el Código

兼容单独打包不登陆的情况

huiqi hace 7 meses
padre
commit
f3c2fbef66

+ 5 - 1
takai-common/src/main/java/com/takai/common/utils/SecurityUtils.java

@@ -66,7 +66,11 @@ public class SecurityUtils
     {
         try
         {
-            return (LoginUser) getAuthentication().getPrincipal();
+            Object res = getAuthentication().getPrincipal();
+            if (res instanceof LoginUser) {
+                return (LoginUser) res;
+            }
+            return null;
         }
         catch (Exception e)
         {