Browse Source

服务级鉴权接口去除日志必填参数

邱宇 4 năm trước cách đây
mục cha
commit
accc1f1271

+ 7 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/api/authservice/v1/controller/AuthServiceController.java

@@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -139,6 +140,12 @@ public class AuthServiceController {
         if (applyInfo == null || BooleanEnum.TRUE.value.equals(applyInfo.getApplyStatus())) {
             return ApiResult.setFailMessage(String.format("app: %s is not enabled", appCode));
         }
+
+        if (StringUtils.isEmpty(idcard)) {
+            DecodedJWT decode = JWT.decode(userToken);
+            idcard = decode.getClaim("idCard").asString();
+        }
+
         Object o = serviceAuthFlowFacade.serviceAuthentication(idcard, appCode, userToken, appToken);
         return ApiResult.setSuccessResult(o);
     }