|
|
@@ -2,6 +2,7 @@ package com.unissoft.utils;
|
|
2
|
2
|
|
|
3
|
3
|
import com.alibaba.fastjson.JSON;
|
|
4
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
|
5
|
+import com.unissoft.MyConstant;
|
|
5
|
6
|
import com.unissoft.model.SysUserPO;
|
|
6
|
7
|
import org.springframework.security.jwt.Jwt;
|
|
7
|
8
|
import org.springframework.security.jwt.JwtHelper;
|
|
|
@@ -26,10 +27,9 @@ public class UserUtils {
|
|
26
|
27
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
27
|
28
|
HttpServletRequest request = attributes.getRequest();
|
|
28
|
29
|
SysUserPO loginUser = null;
|
|
29
|
|
- if (request != null && !StringUtils.isEmpty(request.getHeader("Authorization"))) {
|
|
|
30
|
+ if (request != null && !StringUtils.isEmpty(request.getHeader(MyConstant.AUTHORIZATION))) {
|
|
30
|
31
|
// 只携带token
|
|
31
|
|
- String authorization = request.getHeader("Authorization").replace("bearer ","");
|
|
32
|
|
- System.out.println(authorization);
|
|
|
32
|
+ String authorization = request.getHeader(MyConstant.AUTHORIZATION).replace("bearer ","");
|
|
33
|
33
|
Jwt decode = JwtHelper.decode(authorization);
|
|
34
|
34
|
String claims = decode.getClaims();
|
|
35
|
35
|
JSONObject jsonObject = JSON.parseObject(claims);
|