public class QueryAndEncodeDatabaseAuthenticationHandler extends AbstractJdbcUsernamePasswordAuthenticationHandler
This handler uses the hashing method defined by Apache Shiro's
DefaultHashService. Refer to the Javadocs
to learn more about the behavior. If the hashing behavior and/or configuration
of private and public salts does nto meet your needs, a extension can be developed
to specify alternative methods of encoding and digestion of the encoded password.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
algorithmName
The Algorithm name.
|
protected java.lang.String |
disabledFieldName
The Expired field name.
|
protected java.lang.String |
expiredFieldName
The Expired field name.
|
protected long |
numberOfIterations
The number of iterations.
|
protected java.lang.String |
numberOfIterationsFieldName
The Number of iterations field name.
|
protected java.lang.String |
passwordFieldName
The Password field name.
|
protected java.lang.String |
saltFieldName
The Salt field name.
|
protected java.lang.String |
sql
The Sql statement to execute.
|
protected java.lang.String |
staticSalt
Static/private salt to be combined with the dynamic salt retrieved
from the database.
|
credentialSelectionPredicate, principalFactory, servicesManager| Constructor and Description |
|---|
QueryAndEncodeDatabaseAuthenticationHandler(java.lang.String name,
org.apereo.cas.services.ServicesManager servicesManager,
org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
java.lang.Integer order,
javax.sql.DataSource dataSource,
java.lang.String algorithmName,
java.lang.String sql,
java.lang.String passwordFieldName,
java.lang.String saltFieldName,
java.lang.String expiredFieldName,
java.lang.String disabledFieldName,
java.lang.String numberOfIterationsFieldName,
long numberOfIterations,
java.lang.String staticSalt) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apereo.cas.authentication.HandlerResult |
authenticateUsernamePasswordInternal(org.apereo.cas.authentication.UsernamePasswordCredential transformedCredential,
java.lang.String originalPassword) |
protected java.lang.String |
digestEncodedPassword(java.lang.String encodedPassword,
java.util.Map<java.lang.String,java.lang.Object> values)
Digest encoded password.
|
getDataSource, getJdbcTemplatedoAuthentication, getPasswordPolicyConfiguration, matches, setPasswordEncoder, setPasswordPolicyConfiguration, setPrincipalNameTransformer, supportsauthenticate, createHandlerResultgetName, getOrder, setCredentialSelectionPredicateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected java.lang.String algorithmName
protected java.lang.String sql
protected java.lang.String passwordFieldName
protected java.lang.String saltFieldName
protected java.lang.String expiredFieldName
protected java.lang.String disabledFieldName
protected java.lang.String numberOfIterationsFieldName
protected long numberOfIterations
protected java.lang.String staticSalt
If using this implementation as part of a password hashing strategy, it might be desirable to configure a private salt. A hash and the salt used to compute it are often stored together. If an attacker is ever able to access the hash (e.g. during password cracking) and it has the full salt value, the attacker has all of the input necessary to try to brute-force crack the hash (source + complete salt).
However, if part of the salt is not available to the attacker (because it is not stored with the hash), it is much harder to crack the hash value since the attacker does not have the complete inputs necessary. The privateSalt property exists to satisfy this private-and-not-shared part of the salt.
If you configure this attribute, you can obtain this additional very important safety feature.
public QueryAndEncodeDatabaseAuthenticationHandler(java.lang.String name,
org.apereo.cas.services.ServicesManager servicesManager,
org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
java.lang.Integer order,
javax.sql.DataSource dataSource,
java.lang.String algorithmName,
java.lang.String sql,
java.lang.String passwordFieldName,
java.lang.String saltFieldName,
java.lang.String expiredFieldName,
java.lang.String disabledFieldName,
java.lang.String numberOfIterationsFieldName,
long numberOfIterations,
java.lang.String staticSalt)
protected org.apereo.cas.authentication.HandlerResult authenticateUsernamePasswordInternal(org.apereo.cas.authentication.UsernamePasswordCredential transformedCredential,
java.lang.String originalPassword)
throws java.security.GeneralSecurityException,
org.apereo.cas.authentication.PreventedException
authenticateUsernamePasswordInternal in class org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandlerjava.security.GeneralSecurityExceptionorg.apereo.cas.authentication.PreventedExceptionprotected java.lang.String digestEncodedPassword(java.lang.String encodedPassword,
java.util.Map<java.lang.String,java.lang.Object> values)
encodedPassword - the encoded passwordvalues - the values retrieved from database