mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-05-07 22:27:56 +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()));
|
tokenValue = String.valueOf(storage.get(splicingKeyJustCreatedSave()));
|
||||||
}
|
}
|
||||||
// 2. 再尝试从 请求体 里面读取
|
// 2. 再尝试从 请求体 里面读取
|
||||||
if(tokenValue == null && config.getIsReadBody()){
|
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadBody()){
|
||||||
tokenValue = request.getParam(keyTokenName);
|
tokenValue = request.getParam(keyTokenName);
|
||||||
}
|
}
|
||||||
// 3. 再尝试从 header 头里读取
|
// 3. 再尝试从 header 头里读取
|
||||||
if(tokenValue == null && config.getIsReadHeader()){
|
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadHeader()){
|
||||||
tokenValue = request.getHeader(keyTokenName);
|
tokenValue = request.getHeader(keyTokenName);
|
||||||
}
|
}
|
||||||
// 4. 最后尝试从 cookie 里读取
|
// 4. 最后尝试从 cookie 里读取
|
||||||
if(tokenValue == null && config.getIsReadCookie()){
|
if(SaFoxUtil.isEmpty(tokenValue) && config.getIsReadCookie()){
|
||||||
tokenValue = request.getCookieValue(keyTokenName);
|
tokenValue = request.getCookieValue(keyTokenName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user