mirror of
https://github.com/abcv7/sfbx-cloud.git
synced 2026-08-16 19:49:49 +00:00
功能:在保险、规则、交易、积分和短信模块中实现初始功能和基础组件。
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>sfbx-framework</artifactId>
|
||||
<groupId>com.itheima.sfbx</groupId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!--基础模块-feign支持-->
|
||||
<artifactId>framework-feign</artifactId>
|
||||
<name>framework-feign</name>
|
||||
<!-- FIXME change it to the project's website -->
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itheima.sfbx</groupId>
|
||||
<artifactId>framework-commons</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.itheima.sfbx.framework.feign.config;
|
||||
|
||||
import com.itheima.sfbx.framework.feign.interceptor.FeignAuthInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @ClassName FeignConfig.java
|
||||
* @Description feign的拦截器配置
|
||||
*/
|
||||
@Configuration
|
||||
public class FeignConfig {
|
||||
|
||||
/**
|
||||
* @Description feign自定义拦截器
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public FeignAuthInterceptor feignAuthRequestInterceptor(){
|
||||
|
||||
return new FeignAuthInterceptor();
|
||||
}
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.itheima.sfbx.framework.feign.interceptor;
|
||||
|
||||
import com.itheima.sfbx.framework.commons.constant.security.SecurityConstant;
|
||||
import com.itheima.sfbx.framework.commons.utils.EmptyUtil;
|
||||
import com.itheima.sfbx.framework.commons.utils.SubjectContent;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
/**
|
||||
* @ClassName FeignAuthRequestInterceptor.java
|
||||
* @Description feign请求授权拦截器
|
||||
*/
|
||||
public class FeignAuthInterceptor implements RequestInterceptor {
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
|
||||
if (!EmptyUtil.isNullOrEmpty(SubjectContent.getUserToken())){
|
||||
template.header(SecurityConstant.USER_TOKEN, SubjectContent.getUserToken());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user