Selaa lähdekoodia

feature(增加从jwt解析拿到身份证号):

huangzqa 4 vuotta sitten
vanhempi
sitoutus
92c1e59057

+ 7 - 0
pom.xml

@@ -15,6 +15,7 @@
         <revision>2.1.0-tjdsj-SNAPSHOT</revision>
         <duceap.version>2.1.0-SNAPSHOT</duceap.version>
         <lombok.version>1.18.2</lombok.version>
+        <jwt.version>3.10.3</jwt.version>
     </properties>
 
     <dependencyManagement>
@@ -157,6 +158,12 @@
             <version>2.4.2</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+            <version>${jwt.version}</version>
+        </dependency>
+
         <!--配置 dcuc 结束-->
         <dependency>
             <groupId>net.unicon.cas</groupId>

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

@@ -1,6 +1,8 @@
 package com.dragoninfo.dcuc.authweb.restcontroller.api.authservice.v1.controller;
 
 import cn.hutool.core.util.StrUtil;
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.interfaces.DecodedJWT;
 import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
@@ -74,8 +76,9 @@ public class AuthServiceController {
         if (!checkUserToken) {
             return ApiResult.setFailMessage("用户令牌无效");
         }
-        // todo 获取用户身份证号
-        String idcard = userToken;
+
+        DecodedJWT decode = JWT.decode(userToken);
+        String idcard = decode.getClaim("idcard").asString();
         UserInfo userInfo = userFacade.detailBySfzh(idcard);
         if (userInfo == null) {
             return ApiResult.setFailMessage("用户不存在");