@Requires(beans={UserFetcher.class,PasswordEncoder.class,AuthoritiesFetcher.class}) @Singleton public class DelegatingAuthenticationProvider extends Object implements AuthenticationProvider
Modifier and Type | Field and Description |
---|---|
protected AuthoritiesFetcher |
authoritiesFetcher |
protected PasswordEncoder |
passwordEncoder |
protected UserFetcher |
userFetcher |
Constructor and Description |
---|
DelegatingAuthenticationProvider(UserFetcher userFetcher,
PasswordEncoder passwordEncoder,
AuthoritiesFetcher authoritiesFetcher) |
Modifier and Type | Method and Description |
---|---|
Publisher<AuthenticationResponse> |
authenticate(AuthenticationRequest authenticationRequest)
Attempts to authenticate a user.
|
protected Publisher<AuthenticationResponse> |
createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest,
UserState user)
Create a successful
AuthenticationResponse . |
protected AuthenticationResponse |
createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest,
UserState user,
List<String> authorities)
Create a successful
AuthenticationResponse . |
protected Publisher<UserState> |
fetchUserState(AuthenticationRequest authenticationRequest) |
protected final UserFetcher userFetcher
protected final PasswordEncoder passwordEncoder
protected final AuthoritiesFetcher authoritiesFetcher
public DelegatingAuthenticationProvider(UserFetcher userFetcher, PasswordEncoder passwordEncoder, AuthoritiesFetcher authoritiesFetcher)
userFetcher
- Fetches users from persistencepasswordEncoder
- Collaborator which checks if a raw password matches an encoded passwordauthoritiesFetcher
- Fetches authorities for a particular userpublic Publisher<AuthenticationResponse> authenticate(AuthenticationRequest authenticationRequest)
authenticate
in interface AuthenticationProvider
authenticationRequest
- The authentication request dataprotected Publisher<UserState> fetchUserState(AuthenticationRequest authenticationRequest)
authenticationRequest
- The authentication request dataUserState
. A representation of the state of a user after authentication.protected Publisher<AuthenticationResponse> createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest, UserState user)
AuthenticationResponse
.authenticationRequest
- The authentication request datauser
- A representation of the state of a user after authentication.protected AuthenticationResponse createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest, UserState user, List<String> authorities)
AuthenticationResponse
.authenticationRequest
- The authentication request datauser
- A representation of the state of a user after authentication.authorities
- A list of authorities granted to authenticated user.