| | |
| | | package cc.mrbird.febs.common.configure;
|
| | |
|
| | | import cc.mrbird.febs.common.interceptor.DappInterceptor;
|
| | | import cc.mrbird.febs.common.interceptor.LoginInterceptor;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
| | |
| | |
|
| | | @Override
|
| | | public void addInterceptors(InterceptorRegistry registry) {
|
| | | InterceptorRegistration registration = registry.addInterceptor(new LoginInterceptor());
|
| | | registration.addPathPatterns("/api/**");
|
| | | registration.excludePathPatterns("/api/common/**");
|
| | | registration.excludePathPatterns("/trx/**");
|
| | | // InterceptorRegistration registration = registry.addInterceptor(new LoginInterceptor());
|
| | | // registration.addPathPatterns("/api/**");
|
| | | // registration.addPathPatterns("/dapp/**");
|
| | | // registration.excludePathPatterns("/api/common/**");
|
| | |
|
| | | //
|
| | | InterceptorRegistration registration = registry.addInterceptor(new DappInterceptor());
|
| | | registration.addPathPatterns("/dapi/**");
|
| | | registration.excludePathPatterns("/dapi/common/**");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 设置cors跨域支持
|
| | | *
|
| | | * @param registry
|
| | | */
|
| | | @Override
|
| | | public void addCorsMappings(CorsRegistry registry) {
|
| | | registry.addMapping("/**")
|
| | | .allowedOrigins("*")
|
| | | .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
|
| | | .allowCredentials(true).maxAge(3600);
|
| | | }
|
| | |
|
| | | }
|