mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-14 02:58:09 +08:00
update 日志
This commit is contained in:
@@ -5,6 +5,8 @@ import com.jsowell.common.constant.HttpStatus;
|
|||||||
import com.jsowell.common.core.domain.AjaxResult;
|
import com.jsowell.common.core.domain.AjaxResult;
|
||||||
import com.jsowell.common.util.ServletUtils;
|
import com.jsowell.common.util.ServletUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -23,11 +25,14 @@ import java.io.Serializable;
|
|||||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
|
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
|
||||||
private static final long serialVersionUID = -8970718410437077606L;
|
private static final long serialVersionUID = -8970718410437077606L;
|
||||||
|
|
||||||
|
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
int code = HttpStatus.UNAUTHORIZED;
|
int code = HttpStatus.UNAUTHORIZED;
|
||||||
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
||||||
|
logger.error("认证失败,无法访问系统资源error", e);
|
||||||
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
|
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user