|
|
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
|
9
|
9
|
import com.ruoyi.common.core.constant.CacheConstants;
|
|
10
|
10
|
import com.ruoyi.common.core.constant.Constants;
|
|
11
|
11
|
import com.ruoyi.common.core.utils.IdUtils;
|
|
|
12
|
+import com.ruoyi.common.core.utils.SecurityUtils;
|
|
12
|
13
|
import com.ruoyi.common.core.utils.ServletUtils;
|
|
13
|
14
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
14
|
15
|
import com.ruoyi.common.core.utils.ip.IpUtils;
|
|
|
@@ -71,7 +72,7 @@ public class TokenService
|
|
71
|
72
|
public LoginUser getLoginUser(HttpServletRequest request)
|
|
72
|
73
|
{
|
|
73
|
74
|
// 获取请求携带的令牌
|
|
74
|
|
- String token = getToken(request);
|
|
|
75
|
+ String token = SecurityUtils.getToken(request);
|
|
75
|
76
|
if (StringUtils.isNotEmpty(token))
|
|
76
|
77
|
{
|
|
77
|
78
|
String userKey = getTokenKey(token);
|
|
|
@@ -119,17 +120,4 @@ public class TokenService
|
|
119
|
120
|
{
|
|
120
|
121
|
return ACCESS_TOKEN + token;
|
|
121
|
122
|
}
|
|
122
|
|
-
|
|
123
|
|
- /**
|
|
124
|
|
- * 获取请求token
|
|
125
|
|
- */
|
|
126
|
|
- private String getToken(HttpServletRequest request)
|
|
127
|
|
- {
|
|
128
|
|
- String token = request.getHeader(CacheConstants.HEADER);
|
|
129
|
|
- if (StringUtils.isNotEmpty(token) && token.startsWith(CacheConstants.TOKEN_PREFIX))
|
|
130
|
|
- {
|
|
131
|
|
- token = token.replace(CacheConstants.TOKEN_PREFIX, "");
|
|
132
|
|
- }
|
|
133
|
|
- return token;
|
|
134
|
|
- }
|
|
135
|
123
|
}
|