Class BindParams


  • public class BindParams
    extends java.lang.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
      BindParams()
      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, java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      protected void finalize()
      Releases any native structures associated with this object.
      BindType getBindType()
      Determine what kind of bind operation will be performed when using this set of BindParams.
      java.lang.String getCertificateServerName()
      Determine the name of the LDAP server used for certificate verification.
      long getCertificateServerPort()
      Determine the port number of the LDAP server used for certificate verification.
      boolean getCheckCRLs()
      Determine whether CRL checking is requested.
      int hashCode()  
      void setAnonymous()
      Makes this object ready to be used for an anonymous bind.
      void setCertificateServer​(java.lang.String ldapHost, long ldapPort, boolean checkCRLs)
      Specify the LDAP host to be used for obtaining certificates and CRLs during certificate verification.
      void setIdentity​(Identity identity)
      Set the Identity to be associated with this set of BindParams.
      void setSASL​(SASLParameters saslParams)
      Makes this object ready to be used for a SASL bind.
      void setSimple​(DN bindDN, java.lang.String simplePassword)
      Makes this object ready to be used for a simple bind.
      void setStrong​(Identity identity, DN dsaDN)
      Makes this object ready to be used for a strong bind.
      java.lang.String toString()
      Returns a String representation of this BindParams.
      • Methods inherited from class java.lang.Object

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

      • BindParams

        public BindParams()
                   throws NativeLibraryException
        Create a new BindParams object that will be suitable for using as a no-frills "anonymous" bind.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • BindParams

        public BindParams​(DN bindDN,
                          java.lang.String password)
                   throws NativeLibraryException
        Create a new BindParams object that will be suitable for a "simple" bind.
        Parameters:
        bindDN - The bind DN. This may not be null.
        password - The bind password. This may be null, which would result in a "name-only" bind.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
        java.lang.NullPointerException - if bindDN is null.
        See Also:
        setSimple(DN, String)
      • BindParams

        public BindParams​(Identity identity,
                          DN dsaDN)
                   throws NativeLibraryException
        Create a new BindParams object that will be suitable for a "strong" bind.
        Parameters:
        identity - Identity to use. May not be null.
        dsaDN - DSA's DN. This is only used for DAP connections, and so may be null.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
        java.lang.NullPointerException - if identity is null
        See Also:
        BindParams(Identity), setStrong(Identity, DN)
      • BindParams

        public BindParams​(SASLParameters saslParameters)
                   throws NativeLibraryException
        Create a new BindParams object that will be suitable for a SASL bind over LDAP.

        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:
        saslParameters - SASL parameters. Must not be null.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
        java.lang.NullPointerException - if saslParameters is null
        See Also:
        setSASL(SASLParameters)
      • BindParams

        public BindParams​(BindParams otherBindParams)
                   throws NativeLibraryException
        Create a new BindParams object which is a copy of an existing one.
        Parameters:
        otherBindParams - existing BindParams, which must not be null
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Releases any native structures associated with this object.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.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​(java.lang.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 java.lang.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:
        getCertificateServerName()
      • 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:
        setStrong(Identity, DN)
      • 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,
                                    java.lang.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
        java.lang.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
        java.lang.NullPointerException - if identity is null
        See Also:
        setIdentity(Identity)
      • 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
        java.lang.NullPointerException - if saslMech is null
        See Also:
        BindParams(SASLParameters)
      • toString

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object