Class TwoFactorAuthenticationHandler
java.lang.Object
ch.tocco.nice2.security.spi.auth.AuthenticationHandlerAdapter
ch.tocco.nice2.userbase.impl.auth.TwoFactorAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler
@Component
@Order(300)
public class TwoFactorAuthenticationHandler
extends AuthenticationHandlerAdapter
-
Field Summary
FieldsFields inherited from interface AuthenticationHandler
ANONYMOUS_HANDLER_ORDER, API_KEY_PK_ATTRIBUTE, PRINCIPAL_PK_ATTRIBUTE, SESSION_HASH_HANDLER_ORDER, SESSION_ID_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionTwoFactorAuthenticationHandler(CommandExecutor executor, PrincipalService principalService) -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(Challenge challenge, Credentials credentials) Authenticates the given challenge by voting for or against it.protected org.jboss.aerogear.security.otp.TotpcreateTotp(String secret) voidpostAuthenticate(Challenge challenge) After authentication has been successful for all registered AuthenticationHandlers, the post-authentication step is invoked to add more authorization information to the principal which is sure to be not null and authenticated when this method is invoked.Methods inherited from class AuthenticationHandlerAdapter
getName, updateCredentialsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AuthenticationHandler
postEventListeners
-
Field Details
-
ORDER
public static final int ORDER- See Also:
-
-
Constructor Details
-
TwoFactorAuthenticationHandler
-
-
Method Details
-
authenticate
Description copied from interface:AuthenticationHandlerAuthenticates the given challenge by voting for or against it.
If the supplied credentials are unknown to this handler, it may not vote at all, indicating no meaningful knowledge about the challenge.
- Specified by:
authenticatein interfaceAuthenticationHandler- Overrides:
authenticatein classAuthenticationHandlerAdapter- Parameters:
challenge- the authentication challengecredentials- the credentials supplied by client in case of non-recoverable error. An exception will immediately stop authentication process to failed state.
-
createTotp
-
postAuthenticate
Description copied from interface:AuthenticationHandlerAfter authentication has been successful for all registered AuthenticationHandlers, the post-authentication step is invoked to add more authorization information to the principal which is sure to be not null and authenticated when this method is invoked.
This handler may also decide in this step to give a new vote for this challenge which overrides the previously given vote.
If this throws any exception, authentication process is immediately stopped to failed state.
- Specified by:
postAuthenticatein interfaceAuthenticationHandler- Overrides:
postAuthenticatein classAuthenticationHandlerAdapter- Parameters:
challenge- the challenge to authenticate
-