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);