mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-04-05 17:37:53 +08:00
优化 token 读取策略,空字符串将视为没有提交token
This commit is contained in:
parent
c508e99281
commit
adb600d643
@ -334,15 +334,15 @@ public class StpLogic {
|
||||
tokenValue = String.valueOf(storage.get(splicingKeyJustCreatedSave()));
|
||||
}
|
||||
// 2. 再尝试从 请求体 里面读取
|
||||
if(tokenValue == null && config.getIsReadBody()){
|
||||
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadBody()){
|
||||
tokenValue = request.getParam(keyTokenName);
|
||||
}
|
||||
// 3. 再尝试从 header 头里读取
|
||||
if(tokenValue == null && config.getIsReadHeader()){
|
||||
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadHeader()){
|
||||
tokenValue = request.getHeader(keyTokenName);
|
||||
}
|
||||
// 4. 最后尝试从 cookie 里读取
|
||||
if(tokenValue == null && config.getIsReadCookie()){
|
||||
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadCookie()){
|
||||
tokenValue = request.getCookieValue(keyTokenName);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user