Module io.inverno.mod.security
Class PrincipalAuthenticator<A extends PrincipalCredentials,B extends PrincipalCredentials>
java.lang.Object
io.inverno.mod.security.authentication.AbstractPrincipalAuthenticator<A,B,PrincipalAuthentication>
io.inverno.mod.security.authentication.PrincipalAuthenticator<A,B>
- Type Parameters:
A
- the type of principal credentials to authenticateB
- the type of principal credentials resolved by the credentials resolver
- All Implemented Interfaces:
Authenticator<A,
PrincipalAuthentication>
public class PrincipalAuthenticator<A extends PrincipalCredentials,B extends PrincipalCredentials>
extends AbstractPrincipalAuthenticator<A,B,PrincipalAuthentication>
An authenticator used to authenticate principal credentials.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
- See Also:
-
Field Summary
Fields inherited from class io.inverno.mod.security.authentication.AbstractPrincipalAuthenticator
credentialsMatcher, credentialsResolver
-
Constructor Summary
ConstructorDescriptionPrincipalAuthenticator
(CredentialsResolver<? extends B> credentialsResolver, CredentialsMatcher<? super A, ? super B> credentialsMatcher) Creates a terminal principal authenticator with the specified credentials resolver and credentials matcher. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrincipalAuthentication
createAuthenticated
(B resolvedCredentials) Creates an authenticated authentication resulting from a successful authentication using the resolved trusted credentials.protected PrincipalAuthentication
createDenied
(A credentials, AuthenticationException cause) Creates a denied authentication resulting from a failed authentication.Methods inherited from class io.inverno.mod.security.authentication.AbstractPrincipalAuthenticator
authenticate, setTerminal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.security.authentication.Authenticator
failOnDenied, failOnDeniedAndAnonymous, flatMap, map, or
-
Constructor Details
-
PrincipalAuthenticator
public PrincipalAuthenticator(CredentialsResolver<? extends B> credentialsResolver, CredentialsMatcher<? super A, ? super B> credentialsMatcher) Creates a terminal principal authenticator with the specified credentials resolver and credentials matcher.
The resulting authenticator is terminal and returns denied authentication when the credentials resolver returns no matching credentials corresponding to the credentials to authenticate or when they do not match.
- Parameters:
credentialsResolver
- a credentials resolvercredentialsMatcher
- a credentials matcher
-
-
Method Details
-
createAuthenticated
protected PrincipalAuthentication createAuthenticated(B resolvedCredentials) throws AuthenticationException Description copied from class:AbstractPrincipalAuthenticator
Creates an authenticated authentication resulting from a successful authentication using the resolved trusted credentials.
- Specified by:
createAuthenticated
in classAbstractPrincipalAuthenticator<A extends PrincipalCredentials,
B extends PrincipalCredentials, PrincipalAuthentication> - Parameters:
resolvedCredentials
- the resolved trusted credentials- Returns:
- an authenticated authentication
- Throws:
AuthenticationException
- if there was an error generating the authentication
-
createDenied
protected PrincipalAuthentication createDenied(A credentials, AuthenticationException cause) throws AuthenticationException Description copied from class:AbstractPrincipalAuthenticator
Creates a denied authentication resulting from a failed authentication.
- Specified by:
createDenied
in classAbstractPrincipalAuthenticator<A extends PrincipalCredentials,
B extends PrincipalCredentials, PrincipalAuthentication> - Parameters:
credentials
- the invalid credentialscause
- the authentication error- Returns:
- a denied authentication
- Throws:
AuthenticationException
- if there was an error generating the authentication
-