content: package com.admin4j.framework.security.handler;
  
  import com.admin4j.framework.security.AuthenticationHandler;
  import lombok.RequiredArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.security.core.AuthenticationException;
  import org.springframework.security.web.AuthenticationEntryPoint;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import java.io.IOException;
  
  /**
   * @author andanyang
   * @since 2022/3/24 16:34
   * 自定义返回结果：未登录或登录过期
   */
  @Slf4j
  @RequiredArgsConstructor
  public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
  
      private final AuthenticationHandler authenticationHandler;
  
      @Override
      public void commence(
              HttpServletRequest request,
              HttpServletResponse response,
              AuthenticationException authException)
              throws IOException, ServletException {
  
          authenticationHandler.authenticationEntryPoint(request, response, authException);
      }
  }
  