|
@@ -1,9 +1,11 @@
|
|
package cn.hfln.framework.gateway.config;
|
|
package cn.hfln.framework.gateway.config;
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.context.SaHolder;
|
|
import cn.dev33.satoken.reactor.filter.SaReactorFilter;
|
|
import cn.dev33.satoken.reactor.filter.SaReactorFilter;
|
|
import cn.dev33.satoken.router.SaRouter;
|
|
import cn.dev33.satoken.router.SaRouter;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.util.SaResult;
|
|
import cn.dev33.satoken.util.SaResult;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
@@ -12,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
|
* [Sa-Token 权限认证] 配置类
|
|
* [Sa-Token 权限认证] 配置类
|
|
* @author click33
|
|
* @author click33
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@Configuration
|
|
@Configuration
|
|
public class SaTokenConfigure {
|
|
public class SaTokenConfigure {
|
|
|
|
|
|
@@ -31,12 +34,19 @@ public class SaTokenConfigure {
|
|
// SaRouter.match("/**", "/user/doLogin", r -> StpUtil.checkLogin());
|
|
// SaRouter.match("/**", "/user/doLogin", r -> StpUtil.checkLogin());
|
|
SaRouter.match("/**")
|
|
SaRouter.match("/**")
|
|
.notMatch(saTokenConfigProperties.getLoginUrls())
|
|
.notMatch(saTokenConfigProperties.getLoginUrls())
|
|
- .check(r -> StpUtil.checkLogin());
|
|
|
|
|
|
+ .check(r -> {
|
|
|
|
|
|
- SaRouter.match(saTokenConfigProperties.getPortalServiceName()+"/**")
|
|
|
|
|
|
+ log.info("sa-token checkLogin, request path : {}", SaHolder.getRequest().getRequestPath());
|
|
|
|
+ StpUtil.checkLogin();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ SaRouter.match(saTokenConfigProperties.getPortalServicePath()+"/**")
|
|
.notMatch(saTokenConfigProperties.getLoginUrls())
|
|
.notMatch(saTokenConfigProperties.getLoginUrls())
|
|
.free(rs -> {
|
|
.free(rs -> {
|
|
- SaRouter.match(saTokenConfigProperties.getPortalServiceName()+"/admin/**", r -> StpUtil.checkRole("manager"));
|
|
|
|
|
|
+ SaRouter.match(saTokenConfigProperties.getPortalServicePath()+"/admin/**", r -> StpUtil.checkRole("manager"));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// SaRouter.match(saTokenConfigProperties.getPortalServicePath()+"/admin/**", r -> StpUtil.checkPermission("manager"));
|
|
});
|
|
});
|
|
|
|
|
|
// // 权限认证 -- 不同模块, 校验不同权限
|
|
// // 权限认证 -- 不同模块, 校验不同权限
|