|
@@ -57,11 +57,11 @@ public class ApiTokenUtils {
|
|
|
String token = getGeoToken(request);
|
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
|
try {
|
|
|
- Claims claims = parseToken(token);
|
|
|
- // 解析对应的权限
|
|
|
- String clientId = (String) claims.get(Constants.GEOHAZARDMONITOR_KEY);
|
|
|
- String userKey = getGeoHazardMonitorTokenKey(clientId);
|
|
|
- String tokens = redisCache.getCacheObject(userKey);
|
|
|
+// Claims claims = parseToken(token);
|
|
|
+// // 解析对应的权限
|
|
|
+// String clientId = (String) claims.get(Constants.GEOHAZARDMONITOR_KEY);
|
|
|
+// String userKey = getGeoHazardMonitorTokenKey(clientId);
|
|
|
+ String tokens = redisCache.getCacheObject(token);
|
|
|
return tokens;
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
@@ -88,11 +88,14 @@ public class ApiTokenUtils {
|
|
|
stringBuilder.append("-");
|
|
|
stringBuilder.append(clientSecret);
|
|
|
String tokens = stringBuilder.toString();
|
|
|
- String tokenKey = getGeoHazardMonitorTokenKey(tokens);
|
|
|
- redisCache.setCacheObject(tokenKey, tokens, expireTime, TimeUnit.MINUTES);
|
|
|
Map<String, Object> claims = new HashMap<>();
|
|
|
claims.put(Constants.GEOHAZARDMONITOR_KEY, tokens);
|
|
|
- parameter.add(createToken(claims));
|
|
|
+ //token值
|
|
|
+ String token1 = createToken(claims);
|
|
|
+ int length = token1.length() / 3 * 2;
|
|
|
+ String substring = token1.substring(length);
|
|
|
+ parameter.add(substring);
|
|
|
+ redisCache.setCacheObject(substring, tokens, expireTime, TimeUnit.MINUTES);
|
|
|
return parameter;
|
|
|
}
|
|
|
|