Skip to content

Commit

Permalink
🚀 fix: v2.5.7.20
Browse files Browse the repository at this point in the history
1. 修正 OpenFeign 调用过程中,UserAgent 头信息被修改,新增的(KHTML,like Gecko) 信息中,产生换行符,导致illegalArgumentException 问题。
2. 修正平台data-access-strategy: remote (OpenFeign数据访问模式) 模式下,核心接口未授权问题。
3. 优化平台全局错误信息描述和后端响应的错误信息,让错误提示信息更加准确以及更加友好
4. 修正 OAuth2 Throwable Cause 信息转换成 自定义错误信息类型错误问题。

- 依赖包版本更新
  - aliyun-java-sdk-core 升级至 4.5.30
  - dysmsapi20170525 升级至 2.0.7
  - aliyun-sdk-oss 升级至 3.13.2
  - jpush-client 升级至 3.5.5
  - jiguang-common 升级至 1.1.12
  - bce-java-sdk 升级至 0.10.185
  • Loading branch information
herodotus-ecosystem committed Nov 29, 2021
1 parent f14a96d commit fd2854e
Show file tree
Hide file tree
Showing 39 changed files with 105 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<a href="https://nacos.io/zh-cn/index.html" target="_blank"><img src="https://shields.io/badge/Nacos-2.0.3-brightgreen" alt="Nacos 2.0.3"></a>
<a href="./LICENSE"><img src="https://shields.io/badge/License-Apache--2.0-blue" alt="License Apache 2.0"></a>
<a href="https://blog.csdn.net/Pointer_v" target="_blank"><img src="https://shields.io/badge/Author-%E7%A0%81%E5%8C%A0%E5%90%9B-orange" alt="码匠君"></a>
<a href="#" target="_blank"><img src="https://shields.io/badge/Version-2.5.7.10-red" alt="Version 2.5.7.10"></a>
<a href="#" target="_blank"><img src="https://shields.io/badge/Version-2.5.7.20-red" alt="Version 2.5.7.20"></a>
<a href="https://gitee.com/herodotus/eurynome-cloud"><img src="https://gitee.com/herodotus/eurynome-cloud/badge/star.svg?theme=dark" alt="Gitee star"></a>
<a href="https://gitee.com/herodotus/eurynome-cloud"><img src="https://gitee.com/herodotus/eurynome-cloud/badge/fork.svg?theme=dark" alt="Gitee fork"></a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion configurations/docker/docker-compose/linux/herodotus/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=2.5.7.10
VERSION=2.5.7.20
GATEWAY_SERVICE_NAME=eurynome-cloud-gateway
GATEWAY_SERVICE_PORT=8847
UAA_SERVICE_NAME=eurynome-cloud-uaa
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=2.5.7.10
VERSION=2.5.7.20
GATEWAY_SERVICE_NAME=eurynome-cloud-gateway
GATEWAY_SERVICE_PORT=8847
UAA_SERVICE_NAME=eurynome-cloud-uaa
Expand Down
38 changes: 14 additions & 24 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<groupId>cn.herodotus.eurynome</groupId>
<artifactId>dependencies</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>pom</packaging>

<name>eurynome-cloud-dependencies</name>
Expand Down Expand Up @@ -87,22 +87,22 @@
<minio.version>8.3.3</minio.version>

<!-- 阿里巴巴开源工具依赖 -->
<alibaba-fastjson.version>1.2.75</alibaba-fastjson.version>
<alibaba-jetcache.version>2.6.0</alibaba-jetcache.version>
<alibaba-nacos.version>2.0.3</alibaba-nacos.version>
<fastjson.version>1.2.75</fastjson.version>
<jetcache.version>2.6.0</jetcache.version>
<nacos.version>2.0.3</nacos.version>
<sentinel.version>1.8.2</sentinel.version>

<!-- 国内开源通用组件 -->
<hutool.version>5.7.16</hutool.version>
<okhttps.version>3.3.0</okhttps.version>
<okhttps.version>3.3.1</okhttps.version>
<just-auth.verison>1.16.5</just-auth.verison>
<knife4j.version>3.0.3</knife4j.version>
<easy-captcha.version>1.6.2</easy-captcha.version>

<!--第三方starter-->
<starter-jasypt.version>3.0.4</starter-jasypt.version>
<starter-camunda.version>7.16.0</starter-camunda.version>
<starter-mybatis-plus.version>3.4.3.4</starter-mybatis-plus.version>
<jasypt-spring-boot-starter.version>3.0.4</jasypt-spring-boot-starter.version>
<camunda-bpm-spring-boot-starter-rest.version>7.16.0</camunda-bpm-spring-boot-starter-rest.version>
<mybatis-plus-boot-starter.version>3.4.3.4</mybatis-plus-boot-starter.version>
<mybatis-plus-generator.version>3.5.1</mybatis-plus-generator.version>
<velocity.version>2.3</velocity.version>
</properties>
Expand Down Expand Up @@ -355,19 +355,19 @@
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${alibaba-nacos.version}</version>
<version>${nacos.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${alibaba-fastjson.version}</version>
<version>${fastjson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alicp.jetcache/jetcache-starter-redis -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-starter-redis-lettuce</artifactId>
<version>${alibaba-jetcache.version}</version>
<version>${jetcache.version}</version>
</dependency>


Expand All @@ -383,16 +383,6 @@
<artifactId>okhttps-fastjson</artifactId>
<version>${okhttps.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.ejlchina</groupId>-->
<!-- <artifactId>okhttps-gson</artifactId>-->
<!-- <version>${okhttps.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.ejlchina</groupId>-->
<!-- <artifactId>okhttps-jackson</artifactId>-->
<!-- <version>${okhttps.version}</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/me.zhyd.oauth/JustAuth -->
<dependency>
<groupId>me.zhyd.oauth</groupId>
Expand All @@ -417,19 +407,19 @@
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>${starter-camunda.version}</version>
<version>${camunda-bpm-spring-boot-starter-rest.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.ulisesbocchio/jasypt-spring-boot-starter -->
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${starter-jasypt.version}</version>
<version>${jasypt-spring-boot-starter.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${starter-mybatis-plus.version}</version>
<version>${mybatis-plus-boot-starter.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-generator -->
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions integrates/eurynome-integration-influxdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<parent>
<artifactId>integrates</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>eurynome-integration-influxdb</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions integrates/eurynome-integration-oss/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<parent>
<artifactId>integrates</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>eurynome-integration-oss</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions integrates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>eurynome-cloud</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>integrates</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>pom</packaging>

<name>eurynome-cloud-integrates</name>
Expand Down
2 changes: 1 addition & 1 deletion packages/eurynome-cloud-assistant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public enum ResultStatus {
ACCOUNT_EXPIRED(40107, "账户过期"),
CREDENTIALS_EXPIRED(40108, "凭证过期"),
ACCOUNT_LOCKED(40109, "账户被锁定"),
INTERNAL_AUTHENTICATION(40110, "内部调用未授权接口,请检查接口权限"),
/**
* 本质是用户不存在,但是返回信息不应该太清晰,以防被攻击
*/
Expand Down Expand Up @@ -119,7 +120,7 @@ public enum ResultStatus {
HTTP_MESSAGE_NOT_READABLE_EXCEPTION(50003, "JSON转换为实体出错!"),
TYPE_MISMATCH_EXCEPTION(50004, "类型不匹配"),
MISSING_SERVLET_REQUEST_PARAMETER_EXCEPTION(50005, "接口参数使用错误或必要参数缺失,请查阅接口文档!"),
IllegalArgumentException(50006, "非法参数错误"),
ILLEGAL_ARGUMENT(50006, "非法参数错误"),

SERVICE_UNAVAILABLE(50301, "Service Unavailable"),
GATEWAY_TIMEOUT(50500, "Gateway Timeout"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class HerodotusExceptionHandler {
EXCEPTION_DICTIONARY.put("DisabledException", getUnauthorizedResult(ResultStatus.ACCOUNT_DISABLED));
EXCEPTION_DICTIONARY.put("CredentialsExpiredException", getUnauthorizedResult(ResultStatus.CREDENTIALS_EXPIRED));
EXCEPTION_DICTIONARY.put("InsufficientAuthenticationException", getUnauthorizedResult(ResultStatus.UNAUTHORIZED));
EXCEPTION_DICTIONARY.put("InternalAuthenticationServiceException", getUnauthorizedResult(ResultStatus.INTERNAL_AUTHENTICATION));
// 403.** 对应错误
EXCEPTION_DICTIONARY.put("RepeatSubmissionException", getForbiddenResult(ResultStatus.REPEAT_SUBMISSION));
EXCEPTION_DICTIONARY.put("FrequentRequestsException", getForbiddenResult(ResultStatus.FREQUENT_REQUESTS));
Expand All @@ -74,7 +75,7 @@ public class HerodotusExceptionHandler {
EXCEPTION_DICTIONARY.put("InvalidClientException", getPreconditionFailedResult(ResultStatus.INVALID_GRANT));
EXCEPTION_DICTIONARY.put("InvalidRequestException", getPreconditionFailedResult(ResultStatus.INVALID_REQUEST));
EXCEPTION_DICTIONARY.put("RedirectMismatchException", getPreconditionFailedResult(ResultStatus.INVALID_REDIRECT_URI));
EXCEPTION_DICTIONARY.put("InvalidArgumentException", getPreconditionFailedResult(ResultStatus.INVALID_ARGUMENT));
EXCEPTION_DICTIONARY.put("IllegalAuthenticationArgumentException", getPreconditionFailedResult(ResultStatus.INVALID_ARGUMENT));
// 415.** 对应错误
EXCEPTION_DICTIONARY.put("HttpMediaTypeNotAcceptableException", getUnsupportedMediaTypeResult(ResultStatus.UNSUPPORTED_MEDIA_TYPE));

Expand All @@ -84,7 +85,7 @@ public class HerodotusExceptionHandler {
EXCEPTION_DICTIONARY.put("HttpMessageNotReadableException", getInternalServerErrorResult(ResultStatus.HTTP_MESSAGE_NOT_READABLE_EXCEPTION));
EXCEPTION_DICTIONARY.put("TypeMismatchException", getInternalServerErrorResult(ResultStatus.TYPE_MISMATCH_EXCEPTION));
EXCEPTION_DICTIONARY.put("MissingServletRequestParameterException", getInternalServerErrorResult(ResultStatus.MISSING_SERVLET_REQUEST_PARAMETER_EXCEPTION));
EXCEPTION_DICTIONARY.put("IllegalArgumentException", getInternalServerErrorResult(ResultStatus.IllegalArgumentException));
EXCEPTION_DICTIONARY.put("IllegalArgumentException", getInternalServerErrorResult(ResultStatus.ILLEGAL_ARGUMENT));

// 6*.** 对应错误
EXCEPTION_DICTIONARY.put("BadSqlGrammarException", getInternalServerErrorResult(ResultStatus.BAD_SQL_GRAMMAR));
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>eurynome-cloud-cache</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<description>将Cache和Redis相关抽取出独立组件包。降低代码耦合性,提升代码包的独立性。解决依赖过多,使用过程中还需要进行排除的问题。</description>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-data</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<description>数据相关通用代码组件包,包括JPA,Redis,数据实体等相关内容</description>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-kernel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-kernel</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<description>平台通用的基础依赖,以及接入及管理等通用代码,上中台必需的基础代码。增加这层包,主要目的是抽取webflux和web依赖的通用性,降低其它包之间的耦合性,比如之前data要依赖logstash,logstash要依赖managementproperties</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@

package cn.herodotus.eurynome.kernel.feign;

import cn.herodotus.eurynome.assistant.constant.SymbolConstants;
import cn.hutool.extra.servlet.ServletUtil;
import com.google.common.net.HttpHeaders;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
Expand Down Expand Up @@ -54,6 +56,20 @@ public void apply(RequestTemplate requestTemplate) {
Map<String, String> headers = ServletUtil.getHeaderMap(httpServletRequest);
// 传递所有请求头,防止部分丢失
for (Map.Entry<String, String> entry : headers.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();

// 跳过content-length值的复制。因为服务之间调用需要携带一些用户信息之类的 所以实现了Feign的RequestInterceptor拦截器复制请求头,复制的时候是所有头都复制的,可能导致Content-length长度跟body不一致
// @see https://blog.csdn.net/qq_39986681/article/details/107138740
if (StringUtils.equalsIgnoreCase(key, HttpHeaders.CONTENT_LENGTH)) {
continue;
}

// 解决 UserAgent 信息被修改后,AppleWebKit/537.36 (KHTML,like Gecko)部分存在非法字符的问题
if (StringUtils.equalsIgnoreCase(key, HttpHeaders.USER_AGENT)) {
value = StringUtils.replace(value, SymbolConstants.NEW_LINE, SymbolConstants.BLANK);
}

requestTemplate.header(entry.getKey(), entry.getValue());
}

Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-message/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>eurynome-cloud-message</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-oauth-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-oauth-starter</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-oauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>


<artifactId>eurynome-cloud-oauth</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-rest</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-security</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ public static Result<String> resolveOauthException(Exception exception, String p
OAuth2Exception aex = (OAuth2Exception) exception;
reason = OAuth2Exception.create(aex.getOAuth2ErrorCode(), aex.getMessage());
} else if (exception instanceof InsufficientAuthenticationException) {
reason = (Exception) exception.getCause();
Throwable throwable = exception.getCause();
if (ObjectUtils.isNotEmpty(throwable)) {
reason = new Exception(throwable);
} else {
reason = exception;
}
log.debug("[Herodotus] |- InsufficientAuthenticationException cause content is [{}]", reason.getClass().getSimpleName());
} else {
reason = exception;
Expand Down
4 changes: 2 additions & 2 deletions packages/eurynome-cloud-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
<parent>
<artifactId>packages</artifactId>
<groupId>cn.herodotus.eurynome</groupId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>
</parent>

<artifactId>eurynome-cloud-starter</artifactId>
<version>2.5.7.10</version>
<version>2.5.7.20</version>

<description>通用配置starter,此包的定位是统一未来接入的微服务使用</description>
<packaging>jar</packaging>
Expand Down
Loading

0 comments on commit fd2854e

Please sign in to comment.