From 061cdac58edfa1054d00f2bb3b55e404cebbe10a Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 14 Aug 2019 15:52:56 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20=E4=BC=98=E5=8C=96=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/core/secure/constant/SecureConstant.java | 5 +++++ .../java/org/springblade/core/secure/utils/SecureUtil.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/constant/SecureConstant.java b/blade-core-secure/src/main/java/org/springblade/core/secure/constant/SecureConstant.java index f0f7534..bbd88c0 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/constant/SecureConstant.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/constant/SecureConstant.java @@ -32,6 +32,11 @@ public interface SecureConstant { */ String BASIC_HEADER_PREFIX = "Basic "; + /** + * 认证请求头前缀 + */ + String BASIC_HEADER_PREFIX_EXT = "Basic%20"; + /** * blade_client表字段 */ diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java index 47c066c..4c72de5 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java @@ -379,7 +379,8 @@ public class SecureUtil { public static String[] extractAndDecodeHeader() { // 获取请求头客户端信息 String header = Objects.requireNonNull(WebUtil.getRequest()).getHeader(SecureConstant.BASIC_HEADER_KEY); - if (header == null || !header.startsWith(SecureConstant.BASIC_HEADER_PREFIX)) { + header = Func.toStr(header).replace(SecureConstant.BASIC_HEADER_PREFIX_EXT, SecureConstant.BASIC_HEADER_PREFIX); + if (!header.startsWith(SecureConstant.BASIC_HEADER_PREFIX)) { throw new SecureException("No client information in request header"); } byte[] base64Token = header.substring(6).getBytes(Charsets.UTF_8_NAME);