package com.gihon.component.web.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import com.gihon.component.properties.GihonCommonProperties; import com.gihon.component.web.auth.AuthTokenInterceptor; import com.gihon.component.web.auth.AuthenticationInterceptor; /** * 非Security * * @author baihe * */ @Configuration public class AuthWebMvcConfig implements WebMvcConfigurer { @Autowired private AuthTokenInterceptor authTokenInterceptor; @Autowired private AuthenticationInterceptor authenticationInterceptor; @Autowired private GihonCommonProperties gihonCommonProperties; @Override public void addInterceptors(InterceptorRegistry registry) { // 认证 registry.addInterceptor(authTokenInterceptor).order(Ordered.HIGHEST_PRECEDENCE).addPathPatterns("/**"); // 权限 registry.addInterceptor(authenticationInterceptor).order(Ordered.HIGHEST_PRECEDENCE + 1).addPathPatterns("/**") .excludePathPatterns(gihonCommonProperties.getWhiteUrlList()); } }