18339543638 пре 3 година
родитељ
комит
55b72ba66e

+ 4 - 1
nb-service/web-service/src/main/java/com/nb/web/service/system/auth/ApplyAuthGranter.java

@@ -1,6 +1,7 @@
 package com.nb.web.service.system.auth;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.digest.DigestUtil;
 import cn.hutool.json.JSONObject;
@@ -17,6 +18,7 @@ import com.nb.core.exception.apply.NoExistAppKeyException;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Component;
 
+import java.util.Collection;
 import java.util.HashSet;
 
 /**
@@ -62,7 +64,8 @@ public class ApplyAuthGranter implements IAuthGranter {
             loginUser.setGrantType(source.getGrantType());
             loginUser.setSys(false);
             loginUser.setUsername(source.getAppKey());
-            loginUser.setPermissions(new HashSet<>(applyManager.getPermission(appKey)));
+            Collection<String> permission = applyManager.getPermission(appKey);
+            loginUser.setPermissions(permission==null?new HashSet<>():new HashSet<>(permission));
             loginUser.setId(source.getAppKey());
             loginUser.setLoginType(StpTypeEnum.DEFAULT.getText());
             // 设置用户信息