Class DelegatingAuthenticationProvider

    • Constructor Detail

      • DelegatingAuthenticationProvider

        public DelegatingAuthenticationProvider​(UserFetcher userFetcher,
                                                PasswordEncoder passwordEncoder,
                                                AuthoritiesFetcher authoritiesFetcher)
        Parameters:
        userFetcher - Fetches users from persistence
        passwordEncoder - Collaborator which checks if a raw password matches an encoded password
        authoritiesFetcher - Fetches authorities for a particular user
    • Method Detail

      • authenticate

        public org.reactivestreams.Publisher<AuthenticationResponse> authenticate​(AuthenticationRequest authenticationRequest)
        Attempts to authenticate a user.
        Specified by:
        authenticate in interface AuthenticationProvider
        Parameters:
        authenticationRequest - The authentication request data
        Returns:
        An AuthenticationResponse object which encapsulates the authentication result.
      • fetchUserState

        protected org.reactivestreams.Publisher<UserState> fetchUserState​(AuthenticationRequest authenticationRequest)
        Parameters:
        authenticationRequest - The authentication request data
        Returns:
        UserState. A representation of the state of a user after authentication.
      • createSuccessfulAuthenticationResponse

        protected org.reactivestreams.Publisher<AuthenticationResponse> createSuccessfulAuthenticationResponse​(AuthenticationRequest authenticationRequest,
                                                                                                               UserState user)
        Create a successful AuthenticationResponse.
        Parameters:
        authenticationRequest - The authentication request data
        user - A representation of the state of a user after authentication.
        Returns:
        An AuthenticationResponse object which encapsulates a successful authentication result.
      • createSuccessfulAuthenticationResponse

        protected AuthenticationResponse createSuccessfulAuthenticationResponse​(AuthenticationRequest authenticationRequest,
                                                                                UserState user,
                                                                                java.util.List<java.lang.String> authorities)
        Create a successful AuthenticationResponse.
        Parameters:
        authenticationRequest - The authentication request data
        user - A representation of the state of a user after authentication.
        authorities - A list of authorities granted to authenticated user.
        Returns:
        An AuthenticationResponse object which encapsulates a successful authentication result.