@Configurationpublic class TaobaoWebMvcConfigurer extendsCommonWebMvcConfigurer {
@Autowired
VerifyRsaTokenInterceptor verifyRsaTokenInterceptor;
@Autowired
VerifyShopIdInterceptor verifyShopIdInterceptor;
@Autowired
VerifyAesTokenInterceptor verifyAesTokenInterceptor;/*** 将拦截器注册到此项目中.*/@Overridepublic voidaddInterceptors(InterceptorRegistry registry) {/*1.验证token*/registry.addInterceptor(verifyRsaTokenInterceptor).addPathPatterns("/**")
.excludePathPatterns("/buildToken")
.excludePathPatterns("/importShopId")
.excludePathPatterns("/TaobaoShopStatusGet")
.excludePathPatterns("/slb.html")/*1.TaobaoJushitaJdpUsersGet 需要这个来统计活跃度。这个接口需要的安全度不高,delphi和guanli模块都有调用,完全开放。
2.TaobaoJushitaJdpUserDelete 需要用这个来定时关闭 数据推送,不可拦截。用下面的Aes128拦截器拦截。*/.excludePathPatterns("/TaobaoJushitaJdpUsersGet")
.excludePathPatterns("/TaobaoJushitaJdpUserDelete")/*御城河日志的,这个比较特殊,因为登录前,登录失败的需要对接日志,而此时并没有http协议头的token。所以这个接口放行。*/.excludePathPatterns("/YchLogLogin")
.order(1);/*2.验证shopId*/registry.addInterceptor(verifyShopIdInterceptor).addPathPatterns("/**")
.excludePathPatterns("/buildToken")
.excludePathPatterns("/importShopId")
.excludePathPatterns("/TaobaoShopStatusGet")
.excludePathPatterns("/slb.html")/*1.TaobaoJushitaJdpUsersGet 需要这个来统计活跃度。这个接口需要的安全度不高,delphi和guanli模块都有调用,完全开放。
2.TaobaoJushitaJdpUserDelete 需要用这个来定时关闭 数据推送,不可拦截。用下面的Aes128拦截器拦截。*/.excludePathPatterns("/TaobaoJushitaJdpUsersGet")
.excludePathPatterns("/TaobaoJushitaJdpUserDelete")/*御城河日志相关的5个接口,不做shopId校验,让这5个接口通过。*/.excludePathPatterns("/YchLogTop")
.excludePathPatterns("/YchLogSql")
.excludePathPatterns("/YchLogLogin")
.excludePathPatterns("/YchLogOrder")
.excludePathPatterns("/YchLogSendOrder")
.order(2);/*3.有一些接口,无法验证颁发的token,为了安全,避免接口完全开放,
这类接口利用对称秘钥,验证固定字符串,只增加需要拦截的。多数不需要这个拦截器拦截。
TaobaoJushitaJdpUserDelete -- 场景为,需要 guanli 模块定时调用,其它模块基本用不到。*/registry.addInterceptor(verifyAesTokenInterceptor).addPathPatterns("/TaobaoJushitaJdpUserDelete").order(3);
}
}