mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-01-13 07:05:11 +08:00
update satoken 1.40.0 => 1.42.0 适配所有升级项(改动较多)
SaLoginModel -> SaLoginParameter device -> deviceType satoken BCrypt -> hutool BCrypt(satoken不维护了) SaTokenDao -> SaTokenDaoBySessionFollowObject(satoken做了重构封装) sse 适配新satoken版本拦截器变化
This commit is contained in:
@@ -8,7 +8,6 @@ import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.SseException;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
@@ -33,24 +32,16 @@ public class AuthFilter {
|
||||
return new SaReactorFilter()
|
||||
// 拦截地址
|
||||
.addInclude("/**")
|
||||
.addExclude("/favicon.ico", "/actuator", "/actuator/**")
|
||||
.addExclude("/favicon.ico", "/actuator", "/actuator/**", "/resource/sse")
|
||||
// 鉴权方法:每次访问进入
|
||||
.setAuth(obj -> {
|
||||
// 登录校验 -- 拦截所有路由
|
||||
SaRouter.match("/**")
|
||||
.notMatch(ignoreWhite.getWhites())
|
||||
.check(r -> {
|
||||
ServerHttpRequest request = SaReactorSyncHolder.getContext().getRequest();
|
||||
ServerHttpRequest request = SaReactorSyncHolder.getExchange().getRequest();
|
||||
// 检查是否登录 是否有token
|
||||
try {
|
||||
StpUtil.checkLogin();
|
||||
} catch (NotLoginException e) {
|
||||
if (request.getURI().getPath().contains("sse")) {
|
||||
throw new SseException(e.getMessage(), e.getCode());
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
StpUtil.checkLogin();
|
||||
|
||||
// 检查 header 与 param 里的 clientid 与 token 里的是否一致
|
||||
String headerCid = request.getHeaders().getFirst(LoginHelper.CLIENT_KEY);
|
||||
|
||||
Reference in New Issue
Block a user