InterceptorConfig.java 1.55 KB
package vion.interceptor;

import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@Slf4j
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SaInterceptor(handle -> {
                    StpUtil.checkLogin();
                    StpUtil.renewTimeout(3600L);
                }))
                .addPathPatterns("/api/**")
                .excludePathPatterns("/api/dictionarys")
                .excludePathPatterns("/api/upLoadFile", "/api/ding/callback/**", "/api/wechat/**", "/error")
                .excludePathPatterns("/api/order/sign/*")
                .excludePathPatterns("/api/form/sign/*")
                .excludePathPatterns("/api/wechatCallback")
                .excludePathPatterns("/api/taskTemp")
                .excludePathPatterns("/api/point/frontSubmit")
                .excludePathPatterns("/api/getQRCode", "/api/getFollowingOpenid", "/api/verifyScan")
                .excludePathPatterns("/api/point/getBindQRCode", "/api/point/getBindOpenid")
                .excludePathPatterns("/api/point/upd/{uuid}", "/api/point/get/{uuid}", "/api/point/install/submit/{uuid}", "/api/point/client/reject", "/api/point/reject/uuid/{uuid}");
    }
}