mirror of https://github.com/halo-dev/halo
Set error data when authentication failure
parent
6139392909
commit
f4611a3478
|
@ -36,10 +36,11 @@ public class DefaultAuthenticationFailureHandler implements AuthenticationFailur
|
||||||
public void onFailure(HttpServletRequest request, HttpServletResponse response, HaloException exception) throws IOException, ServletException {
|
public void onFailure(HttpServletRequest request, HttpServletResponse response, HaloException exception) throws IOException, ServletException {
|
||||||
log.warn("Handle unsuccessful authentication, ip: [{}]", ServletUtil.getClientIP(request));
|
log.warn("Handle unsuccessful authentication, ip: [{}]", ServletUtil.getClientIP(request));
|
||||||
|
|
||||||
BaseResponse errorDetail = new BaseResponse();
|
BaseResponse<Object> errorDetail = new BaseResponse<>();
|
||||||
|
|
||||||
errorDetail.setStatus(exception.getStatus().value());
|
errorDetail.setStatus(exception.getStatus().value());
|
||||||
errorDetail.setMessage(exception.getMessage());
|
errorDetail.setMessage(exception.getMessage());
|
||||||
|
errorDetail.setData(exception.getErrorData());
|
||||||
|
|
||||||
if (!productionEnv) {
|
if (!productionEnv) {
|
||||||
errorDetail.setDevMessage(ExceptionUtils.getStackTrace(exception));
|
errorDetail.setDevMessage(ExceptionUtils.getStackTrace(exception));
|
||||||
|
|
Loading…
Reference in New Issue