Class OAuth2LoginAuthenticationFilter

    • Field Detail

      • DEFAULT_FILTER_PROCESSES_URI

        public static final java.lang.String DEFAULT_FILTER_PROCESSES_URI
        The default URI where this Filter processes authentication requests.
        See Also:
        Constant Field Values
    • Constructor Detail

      • OAuth2LoginAuthenticationFilter

        public OAuth2LoginAuthenticationFilter​(ClientRegistrationRepository clientRegistrationRepository,
                                               OAuth2AuthorizedClientService authorizedClientService)
        Constructs an OAuth2LoginAuthenticationFilter using the provided parameters.
        Parameters:
        clientRegistrationRepository - the repository of client registrations
        authorizedClientService - the authorized client service
      • OAuth2LoginAuthenticationFilter

        public OAuth2LoginAuthenticationFilter​(ClientRegistrationRepository clientRegistrationRepository,
                                               OAuth2AuthorizedClientService authorizedClientService,
                                               java.lang.String filterProcessesUrl)
        Constructs an OAuth2LoginAuthenticationFilter using the provided parameters.
        Parameters:
        clientRegistrationRepository - the repository of client registrations
        authorizedClientService - the authorized client service
        filterProcessesUrl - the URI where this Filter will process the authentication requests
      • OAuth2LoginAuthenticationFilter

        public OAuth2LoginAuthenticationFilter​(ClientRegistrationRepository clientRegistrationRepository,
                                               OAuth2AuthorizedClientRepository authorizedClientRepository,
                                               java.lang.String filterProcessesUrl)
        Constructs an OAuth2LoginAuthenticationFilter using the provided parameters.
        Parameters:
        clientRegistrationRepository - the repository of client registrations
        authorizedClientRepository - the authorized client repository
        filterProcessesUrl - the URI where this Filter will process the authentication requests
        Since:
        5.1
    • Method Detail

      • attemptAuthentication

        public Authentication attemptAuthentication​(javax.servlet.http.HttpServletRequest request,
                                                    javax.servlet.http.HttpServletResponse response)
                                             throws AuthenticationException
        Description copied from class: AbstractAuthenticationProcessingFilter
        Performs actual authentication.

        The implementation should do one of the following:

        1. Return a populated authentication token for the authenticated user, indicating successful authentication
        2. Return null, indicating that the authentication process is still in progress. Before returning, the implementation should perform any additional work required to complete the process.
        3. Throw an AuthenticationException if the authentication process fails
        Specified by:
        attemptAuthentication in class AbstractAuthenticationProcessingFilter
        Parameters:
        request - from which to extract parameters and perform the authentication
        response - the response, which may be needed if the implementation has to do a redirect as part of a multi-stage authentication process (such as OpenID).
        Returns:
        the authenticated user token, or null if authentication is incomplete.
        Throws:
        AuthenticationException - if authentication fails.