| | |
| | | package com.xiaopeng.api.config; |
| | | |
| | | |
| | | import com.xiaopeng.unifiedverification.interceptor.CheckForClientInterceptor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| | | |
| | |
| | | public class MiniprogramConfigurer extends WebMvcConfigurerAdapter { |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private CheckForClientInterceptor checkForClientInterceptor; |
| | | |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | // 统一验证服务拦截器 |
| | | registry.addInterceptor(checkForClientInterceptor).addPathPatterns("/mini-program/**"); |
| | | super.addInterceptors(registry); |
| | | try { |
| | | log.info("正在注册小程序拦截器..."); |
| | | // 统一验证服务拦截器 |
| | | registry.addInterceptor(checkForClientInterceptor) |
| | | .addPathPatterns("/base/v1/mini-program/**", "/api/v1/mini-program/**"); |
| | | log.info("小程序拦截器注册成功"); |
| | | } catch (Exception e) { |
| | | log.warn("小程序拦截器注册失败: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |