| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.ydtech.components;
- import cn.dev33.satoken.interceptor.SaInterceptor;
- import cn.dev33.satoken.router.SaRouter;
- import cn.dev33.satoken.stp.StpUtil;
- import org.springframework.stereotype.Component;
- import java.util.ArrayList;
- import java.util.List;
- @Component
- public class TokenInterceptor {
- public static SaInterceptor tokenInterceptor() {
- List<String> notMatchList = new ArrayList<>();
- notMatchList.add("/favicon.ico");//@TODO 静态资源应该不请求后台 需要确认
- notMatchList.add("/captcha.jpg**"); // 验证码
- notMatchList.add("/login");
- notMatchList.add("/sendMsg");
- notMatchList.add("/loginByPhone");
- notMatchList.add("/esmUserInternalcheck/userRegist");
- notMatchList.add("/dict/**"); //字典
- //中煤
- notMatchList.add("/zm/Underwriting"); //自动核保回调
- notMatchList.add("/zm/ArtificialUnderwriting"); //人工核保回调
- notMatchList.add("/order/zhongMeiApi/underwritingCallback");
- notMatchList.add("/order/zhongMeiApi/auditCallback");
- //永安
- notMatchList.add("/order/yongAn/updatePolicy"); // 支付回调
- notMatchList.add("/order/yongAn/getMessage"); // 获取短信消息
- // swagger
- notMatchList.add("/doc.html");
- notMatchList.add("/webjars/**");
- notMatchList.add("/swagger-resources");
- notMatchList.add("/v2/**");
- return new SaInterceptor(handler -> {
- // 指定一条 match 规则
- SaRouter
- .match("/**") // 拦截的 path 列表,可以写多个 */
- .notMatch(notMatchList) // 排除掉的 path 列表,可以写多个
- .check(r -> StpUtil.checkLogin());
- });
- }
- }
|