Quellcode durchsuchen

用户权限验证日志

andy vor 1 Jahr
Ursprung
Commit
5838857278

+ 1 - 1
pom.xml

@@ -11,7 +11,7 @@
     </parent>
     <groupId>com.beifan</groupId>
     <artifactId>foxlibc</artifactId>
-    <version>1.0.0</version>
+    <version>1.0.1</version>
     <name>foxlibc</name>
     <description>foxlibc</description>
     <properties>

+ 11 - 0
src/main/java/com/beifan/foxlibc/modules/controller/AuthenticationController.java

@@ -22,6 +22,8 @@ import com.beifan.foxlibc.modules.pojo.webio.io.AuthenticationSecUserIn;
 import com.beifan.foxlibc.modules.pojo.webio.io.AuthenticationUserIn;
 import com.beifan.foxlibc.modules.service.UserOperateService;
 import com.beifan.foxlibc.modules.service.UserService;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -71,6 +73,12 @@ public class AuthenticationController {
     @NV_TOKEN
     @PostMapping("/application-token")
     public R<AuthenticationOut> applicationToken(@Valid @RequestBody AuthenticationCodeIn authenticationCodeIn) {
+        try {
+            String string = new ObjectMapper().writeValueAsString(authenticationCodeIn);
+            log.debug("获取token:{}", string);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
         Assert.throwIfBool(userService.application(authenticationCodeIn.getAppid(), authenticationCodeIn.getAppSecret()),
                 "appid或app secret不正确");
 
@@ -102,6 +110,9 @@ public class AuthenticationController {
     @PostMapping("/valid/token")
     public R<AuthenticationOut> validToken(@RequestHeader Map<String, String> headers) {
         String token = headers.get("authorization");
+        if (Objects.isNull(token)) {
+            token = headers.get("Authorization");
+        }
         String authId = headers.get("authid");
         /*   WRAN: 异常信息中的 -C401 是指定返回Code。
            如果删除了前端将不能通过 401 判断用户是否过期 */