@Requires(beans={UserFetcher.class,PasswordEncoder.class,AuthoritiesFetcher.class}) @Singleton public class DelegatingAuthenticationProvider extends java.lang.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 |
---|---|
org.reactivestreams.Publisher<AuthenticationResponse> |
authenticate(AuthenticationRequest authenticationRequest)
Attempts to authenticate a user.
|
protected org.reactivestreams.Publisher<AuthenticationResponse> |
createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest,
UserState user)
Create a successful
AuthenticationResponse . |
protected AuthenticationResponse |
createSuccessfulAuthenticationResponse(AuthenticationRequest authenticationRequest,
UserState user,
java.util.List<java.lang.String> authorities)
Create a successful
AuthenticationResponse . |
protected org.reactivestreams.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 org.reactivestreams.Publisher<AuthenticationResponse> authenticate(AuthenticationRequest authenticationRequest)
authenticate
in interface AuthenticationProvider
authenticationRequest
- The authentication request dataprotected org.reactivestreams.Publisher<UserState> fetchUserState(AuthenticationRequest authenticationRequest)
authenticationRequest
- The authentication request dataUserState
. A representation of the state of a user after authentication.protected org.reactivestreams.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, java.util.List<java.lang.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.