Class OAuth2FormLoginAuthenticationFilter

java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
cn.herodotus.engine.oauth2.authentication.configurer.OAuth2FormLoginAuthenticationFilter
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.ApplicationEventPublisherAware, org.springframework.context.EnvironmentAware, org.springframework.context.MessageSourceAware, org.springframework.core.env.EnvironmentCapable, org.springframework.web.context.ServletContextAware

public class OAuth2FormLoginAuthenticationFilter extends org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter

Description: OAuth2 表单登录过滤器

Author:
: gengwei.zheng
Date:
: 2022/4/12 11:08
  • Field Summary

    Fields inherited from class org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter

    SPRING_SECURITY_FORM_PASSWORD_KEY, SPRING_SECURITY_FORM_USERNAME_KEY

    Fields inherited from class org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter

    authenticationDetailsSource, eventPublisher, messages

    Fields inherited from class org.springframework.web.filter.GenericFilterBean

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    OAuth2FormLoginAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authenticationManager, HttpCryptoProcessor httpCryptoProcessor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.Authentication
    attemptAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
     
    void
    setPostOnly(boolean postOnly)
     
    protected void
    unsuccessfulAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException failed)
    重写该方法,避免在日志Debug级别会输出错误信息的问题。

    Methods inherited from class org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter

    getPasswordParameter, getUsernameParameter, obtainPassword, obtainUsername, setDetails, setPasswordParameter, setUsernameParameter

    Methods inherited from class org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter

    afterPropertiesSet, doFilter, getAllowSessionCreation, getAuthenticationManager, getFailureHandler, getRememberMeServices, getSuccessHandler, requiresAuthentication, setAllowSessionCreation, setApplicationEventPublisher, setAuthenticationConverter, setAuthenticationDetailsSource, setAuthenticationFailureHandler, setAuthenticationManager, setAuthenticationSuccessHandler, setContinueChainBeforeSuccessfulAuthentication, setFilterProcessesUrl, setMessageSource, setRememberMeServices, setRequiresAuthenticationRequestMatcher, setSecurityContextHolderStrategy, setSecurityContextRepository, setSessionAuthenticationStrategy, successfulAuthentication

    Methods inherited from class org.springframework.web.filter.GenericFilterBean

    addRequiredProperty, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OAuth2FormLoginAuthenticationFilter

      public OAuth2FormLoginAuthenticationFilter(org.springframework.security.authentication.AuthenticationManager authenticationManager, HttpCryptoProcessor httpCryptoProcessor)
  • Method Details

    • attemptAuthentication

      public org.springframework.security.core.Authentication attemptAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws org.springframework.security.core.AuthenticationException
      Overrides:
      attemptAuthentication in class org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
      Throws:
      org.springframework.security.core.AuthenticationException
    • setPostOnly

      public void setPostOnly(boolean postOnly)
      Overrides:
      setPostOnly in class org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
    • unsuccessfulAuthentication

      protected void unsuccessfulAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException failed) throws IOException, jakarta.servlet.ServletException
      重写该方法,避免在日志Debug级别会输出错误信息的问题。
      Overrides:
      unsuccessfulAuthentication in class org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
      Parameters:
      request - 请求
      response - 响应
      failed - 失败内容
      Throws:
      IOException - IOException
      jakarta.servlet.ServletException - ServletException