mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 12:19:27 +08:00
🎉 优化请求编码问题
This commit is contained in:
parent
f649d2b3ce
commit
061cdac58e
@ -32,6 +32,11 @@ public interface SecureConstant {
|
|||||||
*/
|
*/
|
||||||
String BASIC_HEADER_PREFIX = "Basic ";
|
String BASIC_HEADER_PREFIX = "Basic ";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认证请求头前缀
|
||||||
|
*/
|
||||||
|
String BASIC_HEADER_PREFIX_EXT = "Basic%20";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blade_client表字段
|
* blade_client表字段
|
||||||
*/
|
*/
|
||||||
|
@ -379,7 +379,8 @@ public class SecureUtil {
|
|||||||
public static String[] extractAndDecodeHeader() {
|
public static String[] extractAndDecodeHeader() {
|
||||||
// 获取请求头客户端信息
|
// 获取请求头客户端信息
|
||||||
String header = Objects.requireNonNull(WebUtil.getRequest()).getHeader(SecureConstant.BASIC_HEADER_KEY);
|
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");
|
throw new SecureException("No client information in request header");
|
||||||
}
|
}
|
||||||
byte[] base64Token = header.substring(6).getBytes(Charsets.UTF_8_NAME);
|
byte[] base64Token = header.substring(6).getBytes(Charsets.UTF_8_NAME);
|
||||||
|
Loading…
Reference in New Issue
Block a user