first commit

This commit is contained in:
abcv7
2026-02-25 15:08:40 +08:00
commit 7f1d83ada7
2003 changed files with 144362 additions and 0 deletions
@@ -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>
@@ -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();
}
}
@@ -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());
}
}
}