Package org.ldaptive.auth
Class CompareAuthenticationHandler
java.lang.Object
org.ldaptive.auth.AbstractAuthenticationHandler
org.ldaptive.auth.CompareAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler
,ConnectionFactoryManager
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 class
Represents a password scheme used for attribute comparison. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
Default password attribute.protected static final String
Default password scheme.private String
Password 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 AuthenticationHandlerResponse
authenticateInternal
(Connection c, AuthenticationCriteria criteria) Authenticate on the supplied connection using the supplied criteria.protected byte[]
digestCredential
(Credential credential, String algorithm) Digests the supplied credential using the supplied algorithm.Returns the password attribute.Returns the password scheme.void
Sets the password attribute.void
Sets the password scheme.toString()
Methods inherited from class org.ldaptive.auth.AbstractAuthenticationHandler
authenticate, getAuthenticationControls, getConnectionFactory, processRequestControls, setAuthenticationControls, setConnectionFactory
-
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:AbstractAuthenticationHandler
Authenticate on the supplied connection using the supplied criteria.- Specified by:
authenticateInternal
in 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
-