Class AbstractUsernamePasswordAuthenticationHandler
- java.lang.Object
-
- org.apereo.cas.authentication.AbstractAuthenticationHandler
-
- org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
-
- org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
-
- All Implemented Interfaces:
org.apereo.cas.authentication.AuthenticationHandler,org.apereo.cas.authentication.PrePostAuthenticationHandler,org.springframework.core.Ordered
- Direct Known Subclasses:
AcceptUsersAuthenticationHandler,JaasAuthenticationHandler
public abstract class AbstractUsernamePasswordAuthenticationHandler extends AbstractPreAndPostProcessingAuthenticationHandler
Abstract class to override supports so that we don't need to duplicate the check for UsernamePasswordCredential.- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategypasswordPolicyHandlingStrategyDecide how to execute password policy handling, if at all.-
Fields inherited from class org.apereo.cas.authentication.AbstractAuthenticationHandler
principalFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUsernamePasswordAuthenticationHandler(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.apereo.cas.authentication.AuthenticationHandlerExecutionResultauthenticateUsernamePasswordInternal(UsernamePasswordCredential credential, java.lang.String originalPassword)Authenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password.protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResultdoAuthentication(org.apereo.cas.authentication.Credential credential)Performs the details of authentication and returns an authentication handler result on success.protected booleanmatches(java.lang.CharSequence charSequence, java.lang.String password)Used in case passwordEncoder is used to match raw password with encoded password.booleansupports(java.lang.Class<? extends org.apereo.cas.authentication.Credential> clazz)booleansupports(org.apereo.cas.authentication.Credential credential)protected voidtransformPassword(UsernamePasswordCredential userPass)Transform password.protected voidtransformUsername(UsernamePasswordCredential userPass)Transform username.-
Methods inherited from class org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
authenticate, createHandlerResult, createHandlerResult
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
AbstractUsernamePasswordAuthenticationHandler
protected AbstractUsernamePasswordAuthenticationHandler(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order)
-
-
Method Detail
-
supports
public boolean supports(java.lang.Class<? extends org.apereo.cas.authentication.Credential> clazz)
-
supports
public boolean supports(org.apereo.cas.authentication.Credential credential)
-
doAuthentication
protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult doAuthentication(org.apereo.cas.authentication.Credential credential) throws java.security.GeneralSecurityExceptionDescription copied from class:AbstractPreAndPostProcessingAuthenticationHandlerPerforms the details of authentication and returns an authentication handler result on success.- Specified by:
doAuthenticationin classAbstractPreAndPostProcessingAuthenticationHandler- Parameters:
credential- Credential to authenticate.- Returns:
- Authentication handler result on success.
- Throws:
java.security.GeneralSecurityException- On authentication failure that is thrown out to the caller ofAbstractPreAndPostProcessingAuthenticationHandler.authenticate(Credential).
-
transformPassword
protected void transformPassword(UsernamePasswordCredential userPass) throws javax.security.auth.login.FailedLoginException, javax.security.auth.login.AccountNotFoundException
Transform password.- Parameters:
userPass- the user pass- Throws:
javax.security.auth.login.FailedLoginException- the failed login exceptionjavax.security.auth.login.AccountNotFoundException- the account not found exception
-
transformUsername
protected void transformUsername(UsernamePasswordCredential userPass) throws javax.security.auth.login.AccountNotFoundException
Transform username.- Parameters:
userPass- the user pass- Throws:
javax.security.auth.login.AccountNotFoundException- the account not found exception
-
authenticateUsernamePasswordInternal
protected abstract org.apereo.cas.authentication.AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal(UsernamePasswordCredential credential, java.lang.String originalPassword) throws java.security.GeneralSecurityException, org.apereo.cas.authentication.PreventedException
Authenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password. Override it if implementation need to use original password for authentication.- Parameters:
credential- the credential object bearing the transformed username and password.originalPassword- original password from credential before password encoding- Returns:
- AuthenticationHandlerExecutionResult resolved from credential on authentication success or null if no principal could be resolved from the credential.
- Throws:
java.security.GeneralSecurityException- On authentication failure.org.apereo.cas.authentication.PreventedException- On the indeterminate case when authentication is prevented.
-
matches
protected boolean matches(java.lang.CharSequence charSequence, java.lang.String password)Used in case passwordEncoder is used to match raw password with encoded password. Mainly for BCRYPT password encoders where each encoded password is different and we cannot use traditional compare of encoded strings to check if passwords match- Parameters:
charSequence- raw not encoded passwordpassword- encoded password to compare with- Returns:
- true in case charSequence matched encoded password
-
-