Class BindParams

java.lang.Object
com.isode.dsapi.BindParams

public class BindParams extends Object
BindParams is a class which wraps the DS_BindParams structure.

The DSAPI library uses a DS_BindParams to be able to provide a flexible mechanism for bind operations, allowing callers to choose bind type, whether an Identity is used, etc..

Since:
16.1 (internal 14.6)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new BindParams object that will be suitable for using as a no-frills "anonymous" bind.
    BindParams(BindParams otherBindParams)
    Create a new BindParams object which is a copy of an existing one.
    BindParams(DN bindDN, String password)
    Create a new BindParams object that will be suitable for a "simple" bind.
    BindParams(Identity identity)
    Create a new BindParams object that will be suitable for a "strong" bind over LDAP.
    BindParams(Identity identity, DN dsaDN)
    Create a new BindParams object that will be suitable for a "strong" bind.
    BindParams(SASLParameters saslParameters)
    Create a new BindParams object that will be suitable for a SASL bind over LDAP.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    protected void
    Releases any native structures associated with this object.
    Determine what kind of bind operation will be performed when using this set of BindParams.
    Determine the name of the LDAP server used for certificate verification.
    long
    Determine the port number of the LDAP server used for certificate verification.
    boolean
    Determine whether CRL checking is requested.
     
    int
     
    void
    Makes this object ready to be used for an anonymous bind.
    void
    setCertificateServer(String ldapHost, long ldapPort, boolean checkCRLs)
    Specify the LDAP host to be used for obtaining certificates and CRLs during certificate verification.
    void
    Set the Identity to be associated with this set of BindParams.
    final void
    setSASL(SASLParameters saslParams)
    Makes this object ready to be used for a SASL bind.
    final void
    setSimple(DN bindDN, String simplePassword)
    Makes this object ready to be used for a simple bind.
    final void
    setStrong(Identity identity, DN dsaDN)
    Makes this object ready to be used for a strong bind.
    Returns a String representation of this BindParams.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Releases any native structures associated with this object.
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • getBindType

      public BindType getBindType()
      Determine what kind of bind operation will be performed when using this set of BindParams.
      Returns:
      an enum corresponding to a DSBindType value
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • setCertificateServer

      public void setCertificateServer(String ldapHost, long ldapPort, boolean checkCRLs) throws NativeLibraryException
      Specify the LDAP host to be used for obtaining certificates and CRLs during certificate verification.
      Parameters:
      ldapHost - LDAP host name; use null to indicate that no LDAP server is to be used.
      ldapPort - ldap port number. A value of zero means that the default LDAP port (389) will be used. This value is ignored if ldapHost is null.
      checkCRLs - whether CRL checking should be performed. This value is ignored if ldapHost is null.
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • getCertificateServerName

      public String getCertificateServerName() throws NativeLibraryException
      Determine the name of the LDAP server used for certificate verification.
      Returns:
      a hostname, or null if no certificate verification is configured
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • getCertificateServerPort

      public long getCertificateServerPort() throws NativeLibraryException
      Determine the port number of the LDAP server used for certificate verification.
      Returns:
      a port number, which will be meaningful only a ldaphost has been configured
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
      See Also:
    • getCheckCRLs

      public boolean getCheckCRLs() throws NativeLibraryException
      Determine whether CRL checking is requested.
      Returns:
      a boolean, which will be meaningful only a ldaphost has been configured
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
      See Also:
    • setIdentity

      public void setIdentity(Identity identity) throws NativeLibraryException
      Set the Identity to be associated with this set of BindParams. This method doesn't affect the type of bind being performed - an identity may be used for anonymous, simple or strong binds.
      Parameters:
      identity - the identity, which may be null to clear out any existing identity value.
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
      See Also:
    • setAnonymous

      public void setAnonymous() throws NativeLibraryException
      Makes this object ready to be used for an anonymous bind. Any identity associated with the BindParams is maintained.
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
    • setSimple

      public final void setSimple(DN bindDN, String simplePassword) throws NativeLibraryException
      Makes this object ready to be used for a simple bind.
      Parameters:
      bindDN - the bind DN to be used. Must not be null.
      simplePassword - the password, which may be null for a "name-only" bind.
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
      NullPointerException - if bindDN is null.
    • setStrong

      public final void setStrong(Identity identity, DN dsaDN) throws NativeLibraryException
      Makes this object ready to be used for a strong bind. A DSA DN is required for any strong bind over DAP, but ignored otherwise.
      Parameters:
      identity - the Identity to be used; must not be null. This will replace any identity already in the BindParams object
      dsaDN - the DN to be used, may be null in the case of non-DAP binds
      Throws:
      NativeLibraryException - if an unrecoverable error was detected by the native library
      NullPointerException - if identity is null
      See Also:
    • setSASL

      public final void setSASL(SASLParameters saslParams) throws NotImplementedException
      Makes this object ready to be used for a SASL bind. Any previous SASL parameters associated with this object are discarded.

      The saslParams argument acts simply as a convenient way to group a collection of SASL parameters, and the object itself is not used after its components have been extracted.

      Parameters:
      saslParams - the SASLParameters; must not be null. This will replace any SASLParameters previously specified.
      Throws:
      NotImplementedException - if saslParams cannot be honoured on this system (e.g. require HGE license)
      NativeLibraryException - if an unrecoverable error was detected by the native library
      NullPointerException - if saslMech is null
      See Also:
    • getSaslParameters

      public final SASLParameters getSaslParameters()
    • toString

      public String toString()
      Returns a String representation of this BindParams.
      Overrides:
      toString in class Object
      Returns:
      a String representation of this BindParams
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object