59 lines
1.7 KiB
Plaintext
59 lines
1.7 KiB
Plaintext
|
|
package com.securityControl.common.security.config;
|
||
|
|
|
||
|
|
import com.securityControl.common.security.interceptor.ParamSecureHandler;
|
||
|
|
import org.springframework.context.annotation.Bean;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
import org.springframework.context.annotation.Configuration;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||
|
|
import com.securityControl.common.security.interceptor.HeaderInterceptor;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 拦截器配置
|
||
|
|
*
|
||
|
|
* @author czc
|
||
|
|
*/
|
||
|
|
@Configuration
|
||
|
|
@Component
|
||
|
|
public class WebMvcConfig implements WebMvcConfigurer
|
||
|
|
{
|
||
|
|
/** 不需要拦截地址 */
|
||
|
|
public static final String[] excludeUrls = { "/login", "/logout", "/refresh","/getUserTicket","/sys/logs/saveLogs","/error","/api/ballrisk/findBallGb","/api/ballrisk/getDeviceState","/api/ballrisk/findDeviceStatus","/api/ballrisk/findBallUpDown" };
|
||
|
|
@Override
|
||
|
|
public void addInterceptors(InterceptorRegistry registry)
|
||
|
|
{
|
||
|
|
/* registry.addInterceptor(getParamSecureInterceptor())
|
||
|
|
.addPathPatterns("/**")
|
||
|
|
.excludePathPatterns(excludeUrls)
|
||
|
|
.order(-10);*/
|
||
|
|
|
||
|
|
registry.addInterceptor(getHeaderInterceptor())
|
||
|
|
.addPathPatterns("/**")
|
||
|
|
.excludePathPatterns(excludeUrls)
|
||
|
|
.order(-10);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 自定义请求头拦截器
|
||
|
|
*/
|
||
|
|
@Bean
|
||
|
|
public HeaderInterceptor getHeaderInterceptor()
|
||
|
|
{
|
||
|
|
return new HeaderInterceptor();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 自定义参数拦截器
|
||
|
|
*/
|
||
|
|
@Bean
|
||
|
|
public ParamSecureHandler getParamSecureInterceptor()
|
||
|
|
{
|
||
|
|
return new ParamSecureHandler();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|