| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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");
- notMatchList.add("/api/demo/**"); // 演示接口
- notMatchList.add("/captcha.jpg**"); // 验证码
- notMatchList.add("/login");
- notMatchList.add("/wechat/login"); // 微信登陆
- notMatchList.add("/captchaById"); // 验证码通过ID
- notMatchList.add("/login2");//登录2 配合验证码ID的校验
- notMatchList.add("/sendMsg");
- notMatchList.add("/loginByPhone");
- // notMatchList.add("/esmUserInternalcheck/userRegist");
- notMatchList.add("/dict/**"); //字典
- notMatchList.add("/user/agentRegist"); //个代注册
- notMatchList.add("/user/findById"); //获取用户信息
- notMatchList.add("/template/**"); //系统模板
- // 文件访问路劲
- notMatchList.add("/upload/**");
- // app 最大版本查询
- notMatchList.add("/sysVersion/queryMaxNum");
- notMatchList.add("/sysVersion/findPage");
- //财务 - 对账 - 保司数据下载
- notMatchList.add("/api/inv/insExternalBills/export/**");
- //中煤
- 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/**");
- // 支付二维码地址
- notMatchList.add("/order/qrCode/index**");
- notMatchList.add("/order/qrCode/error");
- notMatchList.add("/order/qrCode/getQrCode**");
- notMatchList.add("/order/qrCode/destructionQrCode**");
- // 数据大屏接口
- notMatchList.add("/screen/data/**");
- return new SaInterceptor(handler -> {
- // 指定一条 match 规则
- SaRouter
- .match("/**") // 拦截的 path 列表,可以写多个 */
- .notMatch(notMatchList) // 排除掉的 path 列表,可以写多个
- .check(r -> StpUtil.checkLogin());
- });
- }
- }
|