Commit 556ce5c3 by 罗承锋

优化垂直鉴权

parent 15496373
......@@ -65,10 +65,11 @@ public class AuthIntercept extends HandlerInterceptorAdapter {
String key = AUTH_REDIS_PREFIX + StringUtils.join(roleList.toArray(), ",");
String securityKey = AUTH_REDIS_SECURITY + security;
String securityValue = stringRedisTemplate.opsForValue().get(securityKey);
if (StringUtils.isNotBlank(securityValue)) {
Boolean aBoolean = stringRedisTemplate.opsForValue().setIfAbsent(securityKey, "1");
if (!aBoolean) {
return false;
}else {
stringRedisTemplate.opsForValue().set(securityKey, "1", 1, TimeUnit.DAYS);
}
ResponseData<String> stringResponseData = LoginUtils.pwdDecrypt(security);
......@@ -102,9 +103,6 @@ public class AuthIntercept extends HandlerInterceptorAdapter {
log.info(menu.getUrl());
if (StringUtils.equals(menu.getUrl(), data)) {
log.info("获取到相同的菜单");
stringRedisTemplate.opsForValue().set(securityKey, "1", 1, TimeUnit.HOURS);
return true;
}
}
......
......@@ -72,9 +72,11 @@ public class AuthIntercept extends HandlerInterceptorAdapter {
String securityKey = AUTH_REDIS_SECURITY + security;
String securityValue = stringRedisTemplate.opsForValue().get(securityKey);
if (StringUtils.isNotBlank(securityValue)) {
Boolean aBoolean = stringRedisTemplate.opsForValue().setIfAbsent(securityKey, "1");
if (!aBoolean) {
return false;
}else {
stringRedisTemplate.opsForValue().set(securityKey, "1", 1, TimeUnit.DAYS);
}
ResponseData<String> stringResponseData = LoginUtils.pwdDecrypt(security);
......@@ -108,9 +110,6 @@ public class AuthIntercept extends HandlerInterceptorAdapter {
log.info(menu.getUrl());
if (StringUtils.equals(menu.getUrl(), data)) {
log.info("获取到相同的菜单");
stringRedisTemplate.opsForValue().set(securityKey, "1", 1, TimeUnit.HOURS);
return true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment