Package org.ldaptive.auth
Class CompareAuthenticationHandler
- java.lang.Object
-
- org.ldaptive.auth.AbstractAuthenticationHandler
-
- org.ldaptive.auth.CompareAuthenticationHandler
-
- All Implemented Interfaces:
AuthenticationHandler,ConnectionFactoryManager
public class CompareAuthenticationHandler extends AbstractAuthenticationHandler
Provides an LDAP authentication implementation that uses a compare operation against the userPassword attribute. The default password scheme used is 'SHA'.- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompareAuthenticationHandler.SchemeRepresents a password scheme used for attribute comparison.
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_ATTRIBUTEDefault password attribute.protected static java.lang.StringDEFAULT_SCHEMEDefault password scheme.-
Fields inherited from class org.ldaptive.auth.AbstractAuthenticationHandler
logger
-
-
Constructor Summary
Constructors Constructor Description CompareAuthenticationHandler()Default constructor.CompareAuthenticationHandler(ConnectionFactory cf)Creates a new compare authentication handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AuthenticationHandlerResponseauthenticateInternal(Connection c, AuthenticationCriteria criteria)Authenticate on the supplied connection using the supplied criteria.protected byte[]digestCredential(Credential credential, java.lang.String algorithm)Digests the supplied credential using the supplied algorithm.java.lang.StringgetPasswordAttribute()Returns the password attribute.java.lang.StringgetPasswordScheme()Returns the password scheme.voidsetPasswordAttribute(java.lang.String s)Sets the password attribute.voidsetPasswordScheme(java.lang.String s)Sets the password scheme.java.lang.StringtoString()-
Methods inherited from class org.ldaptive.auth.AbstractAuthenticationHandler
authenticate, getAuthenticationControls, getConnectionFactory, processRequestControls, setAuthenticationControls, setConnectionFactory
-
-
-
-
Field Detail
-
DEFAULT_SCHEME
protected static final java.lang.String DEFAULT_SCHEME
Default password scheme. Value is "SHA:SHA".- See Also:
- Constant Field Values
-
DEFAULT_ATTRIBUTE
protected static final java.lang.String DEFAULT_ATTRIBUTE
Default password attribute. Value is "userPassword".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompareAuthenticationHandler
public CompareAuthenticationHandler()
Default constructor.
-
CompareAuthenticationHandler
public CompareAuthenticationHandler(ConnectionFactory cf)
Creates a new compare authentication handler.- Parameters:
cf- connection factory
-
-
Method Detail
-
getPasswordScheme
public java.lang.String getPasswordScheme()
Returns the password scheme.- Returns:
- password scheme
-
setPasswordScheme
public void setPasswordScheme(java.lang.String s)
Sets the password scheme.- Parameters:
s- password scheme
-
getPasswordAttribute
public java.lang.String getPasswordAttribute()
Returns the password attribute.- Returns:
- password attribute
-
setPasswordAttribute
public void setPasswordAttribute(java.lang.String s)
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
protected byte[] digestCredential(Credential credential, java.lang.String algorithm) throws LdapException
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-