In case of authentication failure, add a clear response code

This commit is contained in:
Liu-XinYuan
2021-04-28 17:14:03 +08:00
parent 06071c2f9c
commit 8efcf0529f

View File

@@ -67,6 +67,7 @@ public class LoginServiceImpl implements LoginService {
if (ValidateUtils.isNull(classRequestMappingValue)) {
LOGGER.error("class=LoginServiceImpl||method=checkLogin||msg=uri illegal||uri={}", request.getRequestURI());
singleSignOn.setRedirectToLoginPage(response);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return false;
}
@@ -83,6 +84,7 @@ public class LoginServiceImpl implements LoginService {
if (ValidateUtils.isBlank(username)) {
// 未登录, 则返回false, 同时重定向到登录页面
singleSignOn.setRedirectToLoginPage(response);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return false;
}
@@ -113,4 +115,4 @@ public class LoginServiceImpl implements LoginService {
}
return true;
}
}
}