yijiusmile
2021-04-20 096f6025e0212b23df8485b56818c3f0b019aa26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cc.mrbird.febs.common.security.starter.configure;
 
import cc.mrbird.febs.common.security.starter.interceptor.FebsServerProtectInterceptor;
import cc.mrbird.febs.common.security.starter.properties.FebsCloudSecurityProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
/**
 * @author MrBird
 */
public class FebsCloudSecurityInteceptorConfigure implements WebMvcConfigurer {
 
    private FebsCloudSecurityProperties properties;
 
    @Autowired
    public void setProperties(FebsCloudSecurityProperties properties) {
        this.properties = properties;
    }
 
    @Bean
    public HandlerInterceptor febsServerProtectInterceptor() {
        FebsServerProtectInterceptor febsServerProtectInterceptor = new FebsServerProtectInterceptor();
        febsServerProtectInterceptor.setProperties(properties);
        return febsServerProtectInterceptor;
    }
 
    @Override
    @SuppressWarnings("all")
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(febsServerProtectInterceptor());
    }
}