Class AuthenticationFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.web.filter.OncePerRequestFilter
org.springframework.security.web.authentication.AuthenticationFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.EnvironmentAware, org.springframework.core.env.EnvironmentCapable, org.springframework.web.context.ServletContextAware

public class AuthenticationFilter extends org.springframework.web.filter.OncePerRequestFilter
A Filter that performs authentication of a particular request. An outline of the logic:
Since:
5.2.0
  • Constructor Details

    • AuthenticationFilter

      public AuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authenticationManager, AuthenticationConverter authenticationConverter)
    • AuthenticationFilter

      public AuthenticationFilter(org.springframework.security.authentication.AuthenticationManagerResolver<jakarta.servlet.http.HttpServletRequest> authenticationManagerResolver, AuthenticationConverter authenticationConverter)
  • Method Details

    • getRequestMatcher

      public RequestMatcher getRequestMatcher()
    • setRequestMatcher

      public void setRequestMatcher(RequestMatcher requestMatcher)
    • getAuthenticationConverter

      public AuthenticationConverter getAuthenticationConverter()
    • setAuthenticationConverter

      public void setAuthenticationConverter(AuthenticationConverter authenticationConverter)
    • getSuccessHandler

      public AuthenticationSuccessHandler getSuccessHandler()
    • setSuccessHandler

      public void setSuccessHandler(AuthenticationSuccessHandler successHandler)
    • getFailureHandler

      public AuthenticationFailureHandler getFailureHandler()
    • setFailureHandler

      public void setFailureHandler(AuthenticationFailureHandler failureHandler)
    • getAuthenticationManagerResolver

      public org.springframework.security.authentication.AuthenticationManagerResolver<jakarta.servlet.http.HttpServletRequest> getAuthenticationManagerResolver()
    • setAuthenticationManagerResolver

      public void setAuthenticationManagerResolver(org.springframework.security.authentication.AuthenticationManagerResolver<jakarta.servlet.http.HttpServletRequest> authenticationManagerResolver)
    • setSecurityContextRepository

      public void setSecurityContextRepository(SecurityContextRepository securityContextRepository)
      Sets the SecurityContextRepository to save the SecurityContext on authentication success. The default action is not to save the SecurityContext.
      Parameters:
      securityContextRepository - the SecurityContextRepository to use. Cannot be null.
    • setSecurityContextHolderStrategy

      public void setSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy)
      Sets the SecurityContextHolderStrategy to use. The default action is to use the SecurityContextHolderStrategy stored in SecurityContextHolder.
      Since:
      5.8
    • doFilterInternal

      protected void doFilterInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain filterChain) throws jakarta.servlet.ServletException, IOException
      Specified by:
      doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
      Throws:
      jakarta.servlet.ServletException
      IOException