| | |
| | | import cn.dev33.satoken.router.SaRouter; |
| | | import cn.dev33.satoken.stp.StpLogic; |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.framework.config.properties.ExcludeUrlProperties; |
| | | import com.ruoyi.framework.config.properties.SecurityProperties; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | // 注åè·¯ç±æ¦æªå¨ï¼èªå®ä¹éªè¯è§å |
| | | registry.addInterceptor(new SaInterceptor(handler -> { |
| | | // èªå®ä¹æ³¨è§£ @Anonymous å¿å访é®é
ç½®ï¼åç»çæ¬å°å é¤ |
| | | ExcludeUrlProperties excludeUrlProperties = SpringUtils.getBean(ExcludeUrlProperties.class); |
| | | // ç»å½éªè¯ -- æé¤å¤ä¸ªè·¯å¾ |
| | | SaRouter |
| | | // è·åææç |
| | | .match("/**") |
| | | // æé¤ä¸ä¸éè¦æ¦æªçï¼æ¯æ¬¡å¹é
ï¼ |
| | | .notMatch(excludeUrlProperties.getExcludes()) |
| | | // å¯¹æªæé¤çè·¯å¾è¿è¡æ£æ¥ |
| | | .check(() -> { |
| | | // æ£æ¥æ¯å¦ç»å½ æ¯å¦ætoken |