package com.koobietech.eas.security.exception;

import com.koobietech.eas.common.utils.ResponseManager;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author lc
 */
public class EasAuthenticationEntryPoint implements AuthenticationEntryPoint {
    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response,
                         AuthenticationException authException) {
        System.out.println( authException.getMessage() );
        authException.printStackTrace();
        ResponseManager.printResponse(response, "不允许访问", 403);
    }
}