package com.meiruo.cosmetics.config; import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.jwt.SaJwtManager; import cn.dev33.satoken.jwt.StpLogicJwtForSimple; import cn.dev33.satoken.stp.StpInterface; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.ArrayList; import java.util.List; @Configuration public class SaTokenConfig implements WebMvcConfigurer { @Bean public StpLogicJwtForSimple stpLogicJwtForSimple() { return new StpLogicJwtForSimple(); } @Bean public StpInterface stpInterface() { return new StpInterface() { @Override public List getPermissionList(Object loginId, String loginType) { return new ArrayList<>(); } @Override public List getRoleList(Object loginId, String loginType) { return new ArrayList<>(); } }; } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new SaInterceptor()).addPathPatterns("/api/**").excludePathPatterns("/api/user/login", "/api/user/register"); } }