Package org.ldaptive.auth
Class CompareAuthenticationHandler
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.auth.AbstractAuthenticationHandler
org.ldaptive.auth.CompareAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler,ConnectionFactoryManager,Freezable
Provides an LDAP authentication implementation that uses a compare operation against the userPassword attribute. The
default password scheme used is 'SHA'.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a password scheme used for attribute comparison. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringDefault password attribute.private static final StringDefault password scheme.private StringPassword attribute.Password scheme.Fields inherited from class org.ldaptive.auth.AbstractAuthenticationHandler
logger -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Creates a new compare authentication handler. -
Method Summary
Modifier and TypeMethodDescriptionprotected AuthenticationHandlerResponseauthenticateInternal(Connection c, AuthenticationCriteria criteria) Authenticate on the supplied connection using the supplied criteria.private byte[]digestCredential(Credential credential, String algorithm) Digests the supplied credential using the supplied algorithm.Returns the password attribute.Returns the password scheme.voidSets the password attribute.voidSets the password scheme.toString()Methods inherited from class org.ldaptive.auth.AbstractAuthenticationHandler
authenticate, freeze, getAuthenticationControls, getConnectionFactory, processRequestControls, setAuthenticationControls, setConnectionFactoryMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
Field Details
-
DEFAULT_SCHEME
Default password scheme. Value is "SHA:SHA".- See Also:
-
DEFAULT_ATTRIBUTE
Default password attribute. Value is "userPassword".- See Also:
-
passwordScheme
Password scheme. -
passwordAttribute
Password attribute.
-
-
Constructor Details
-
CompareAuthenticationHandler
public CompareAuthenticationHandler()Default constructor. -
CompareAuthenticationHandler
Creates a new compare authentication handler.- Parameters:
cf- connection factory
-
-
Method Details
-
getPasswordScheme
Returns the password scheme.- Returns:
- password scheme
-
setPasswordScheme
Sets the password scheme.- Parameters:
s- password scheme
-
getPasswordAttribute
Returns the password attribute.- Returns:
- password attribute
-
setPasswordAttribute
Sets the password attribute. Must equal a readable attribute in LDAP scheme.- Parameters:
s- password attribute
-
authenticateInternal
protected AuthenticationHandlerResponse authenticateInternal(Connection c, AuthenticationCriteria criteria) throws LdapException Description copied from class:AbstractAuthenticationHandlerAuthenticate on the supplied connection using the supplied criteria.- Specified by:
authenticateInternalin classAbstractAuthenticationHandler- Parameters:
c- to authenticate oncriteria- criteria to authenticate with- Returns:
- authentication handler response
- Throws:
LdapException- if the authentication fails
-
digestCredential
Digests the supplied credential using the supplied algorithm.- Parameters:
credential- to digestalgorithm- type of digest to use- Returns:
- digested credential
- Throws:
LdapException- if the supplied algorithm cannot be found
-
toString
- Overrides:
toStringin classAbstractAuthenticationHandler
-