2020-03-07 14:40:15 +08:00
|
|
|
|
package com.pj.satoken;
|
|
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
2020-06-15 22:03:41 +08:00
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
2020-03-07 14:40:15 +08:00
|
|
|
|
|
2021-01-11 20:08:17 +08:00
|
|
|
|
import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;
|
2020-03-07 14:40:15 +08:00
|
|
|
|
|
2021-04-11 22:05:36 +08:00
|
|
|
|
|
2020-03-07 14:40:15 +08:00
|
|
|
|
/**
|
2021-04-11 22:05:36 +08:00
|
|
|
|
* [Sa-Token 权限认证] 配置类
|
2021-03-14 00:04:11 +08:00
|
|
|
|
* @author kong
|
|
|
|
|
*
|
2020-03-07 14:40:15 +08:00
|
|
|
|
*/
|
|
|
|
|
@Configuration
|
2021-04-12 03:22:01 +08:00
|
|
|
|
public class SaTokenConfigure implements WebMvcConfigurer {
|
2020-03-07 14:40:15 +08:00
|
|
|
|
|
2021-04-12 03:22:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* 注册sa-token的拦截器,打开注解式鉴权功能
|
|
|
|
|
*/
|
2020-03-07 14:40:15 +08:00
|
|
|
|
@Override
|
|
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
2021-01-11 20:08:17 +08:00
|
|
|
|
// 注册注解拦截器
|
2021-01-13 02:00:47 +08:00
|
|
|
|
registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**");
|
2020-03-07 14:40:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|