【修复】前端传入token为undefined时,判断为无效

pull/22/head
xuyuxiang 2021-03-16 16:58:24 +08:00
parent dcdd0d1c63
commit 9d573cca6d
2 changed files with 6 additions and 1 deletions

View File

@ -126,4 +126,9 @@ public interface CommonConstant {
* *
*/ */
String IMAGE_CODE_TYPE = "clickWord"; String IMAGE_CODE_TYPE = "clickWord";
/**
* undefined
*/
String UNDEFINED = "undefined";
} }

View File

@ -171,7 +171,7 @@ public class AuthServiceImpl implements AuthService, UserDetailsService {
@Override @Override
public String getTokenFromRequest(HttpServletRequest request) { public String getTokenFromRequest(HttpServletRequest request) {
String authToken = request.getHeader(CommonConstant.AUTHORIZATION); String authToken = request.getHeader(CommonConstant.AUTHORIZATION);
if (ObjectUtil.isEmpty(authToken)) { if (ObjectUtil.isEmpty(authToken) || CommonConstant.UNDEFINED.equals(authToken)) {
return null; return null;
} else { } else {
//token不是以Bearer打头则响应回格式不正确 //token不是以Bearer打头则响应回格式不正确