Skip to content

Commit

Permalink
fix-GatewayRuntimeProvider-whoami从gw-user获取用户不支持中文字符的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aruis committed Dec 26, 2024
1 parent 4b2c593 commit e5714f3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Base64;
import java.util.Optional;

@ApplicationScoped
Expand All @@ -20,7 +21,7 @@ public Optional<IRuntimeUser> getUser(RoutingContext context) {
.flatMap(gwUser -> {
try {
// 尝试构建用户对象
return Optional.of(IRuntimeUser.build(new JsonObject(gwUser)));
return Optional.of(IRuntimeUser.build(new JsonObject(new String(Base64.getDecoder().decode(gwUser)))));
} catch (Exception e) {
// 记录解析失败的日志
LOGGER.warn("Failed to parse gw-user header: {}", gwUser, e);
Expand Down

0 comments on commit e5714f3

Please sign in to comment.