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'.
  • Field Details

  • Constructor Details

    • CompareAuthenticationHandler

      public CompareAuthenticationHandler()
      Default constructor.
    • CompareAuthenticationHandler

      public CompareAuthenticationHandler(ConnectionFactory cf)
      Creates a new compare authentication handler.
      Parameters:
      cf - connection factory
  • Method Details

    • getPasswordScheme

      public String getPasswordScheme()
      Returns the password scheme.
      Returns:
      password scheme
    • setPasswordScheme

      public void setPasswordScheme(String s)
      Sets the password scheme.
      Parameters:
      s - password scheme
    • getPasswordAttribute

      public String getPasswordAttribute()
      Returns the password attribute.
      Returns:
      password attribute
    • setPasswordAttribute

      public void setPasswordAttribute(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: AbstractAuthenticationHandler
      Authenticate on the supplied connection using the supplied criteria.
      Specified by:
      authenticateInternal in class AbstractAuthenticationHandler
      Parameters:
      c - to authenticate on
      criteria - criteria to authenticate with
      Returns:
      authentication handler response
      Throws:
      LdapException - if the authentication fails
    • digestCredential

      protected byte[] digestCredential(Credential credential, String algorithm) throws LdapException
      Digests the supplied credential using the supplied algorithm.
      Parameters:
      credential - to digest
      algorithm - type of digest to use
      Returns:
      digested credential
      Throws:
      LdapException - if the supplied algorithm cannot be found
    • toString

      public String toString()
      Overrides:
      toString in class Object