|
@@ -5,6 +5,7 @@ import com.auth0.jwt.JWTVerifier;
|
|
|
import com.auth0.jwt.algorithms.Algorithm;
|
|
import com.auth0.jwt.algorithms.Algorithm;
|
|
|
import com.auth0.jwt.interfaces.Claim;
|
|
import com.auth0.jwt.interfaces.Claim;
|
|
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
|
|
|
|
+import com.usoftchina.bi.core.base.BaseContextHolder;
|
|
|
import com.usoftchina.bi.core.exception.MyException;
|
|
import com.usoftchina.bi.core.exception.MyException;
|
|
|
import com.usoftchina.bi.server.model.po.TokenData;
|
|
import com.usoftchina.bi.server.model.po.TokenData;
|
|
|
import com.usoftchina.bi.server.model.po.User;
|
|
import com.usoftchina.bi.server.model.po.User;
|
|
@@ -91,6 +92,8 @@ public class JwtTokenAspect {
|
|
|
} catch (MyException e) {
|
|
} catch (MyException e) {
|
|
|
throw new MyException(-505, "token过期");
|
|
throw new MyException(-505, "token过期");
|
|
|
}
|
|
}
|
|
|
|
|
+ BaseContextHolder.setUserId(Integer.valueOf(jwt.getClaim("id").asString()));
|
|
|
|
|
+ BaseContextHolder.setUserName(jwt.getClaim("name").asString());
|
|
|
return jwt.getClaims();
|
|
return jwt.getClaims();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|