Set error data when authentication failure

pull/137/head
johnniang 2019-03-28 01:32:01 +08:00
parent 6139392909
commit f4611a3478
1 changed files with 2 additions and 1 deletions

View File

@ -36,10 +36,11 @@ public class DefaultAuthenticationFailureHandler implements AuthenticationFailur
public void onFailure(HttpServletRequest request, HttpServletResponse response, HaloException exception) throws IOException, ServletException {
log.warn("Handle unsuccessful authentication, ip: [{}]", ServletUtil.getClientIP(request));
BaseResponse errorDetail = new BaseResponse();
BaseResponse<Object> errorDetail = new BaseResponse<>();
errorDetail.setStatus(exception.getStatus().value());
errorDetail.setMessage(exception.getMessage());
errorDetail.setData(exception.getErrorData());
if (!productionEnv) {
errorDetail.setDevMessage(ExceptionUtils.getStackTrace(exception));