content: package com.admin4j.framework.security.handler;
  
  import com.admin4j.framework.security.AuthenticationHandler;
  import lombok.RequiredArgsConstructor;
  import org.springframework.beans.BeansException;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.ApplicationContextAware;
  import org.springframework.security.core.Authentication;
  import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import java.io.IOException;
  
  /**
   * @author andanyang
   * @since 2023/5/30 15:31
   */
  @RequiredArgsConstructor
  public class RestAuthenticationSuccessHandler implements AuthenticationSuccessHandler, ApplicationContextAware {
      final AuthenticationHandler authenticationHandler;
      private ApplicationContext applicationContext;
  
      @Override
      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
          this.applicationContext = applicationContext;
      }
  
      @Override
      public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
  
  
          authenticationHandler.onAuthenticationSuccess(request, response, authentication);
      }
  }
  