Package com.isode.dsapi
Class BindParams
java.lang.Object
com.isode.dsapi.BindParams
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
ConstructorsConstructorDescriptionCreate 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 TypeMethodDescriptionbooleanprotected voidfinalize()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.longDetermine the port number of the LDAP server used for certificate verification.booleanDetermine whether CRL checking is requested.final SASLParametersinthashCode()voidMakes this object ready to be used for an anonymous bind.voidsetCertificateServer(String ldapHost, long ldapPort, boolean checkCRLs) Specify the LDAP host to be used for obtaining certificates and CRLs during certificate verification.voidsetIdentity(Identity identity) Set the Identity to be associated with this set of BindParams.final voidsetSASL(SASLParameters saslParams) Makes this object ready to be used for a SASL bind.final voidMakes this object ready to be used for a simple bind.final voidMakes this object ready to be used for a strong bind.toString()Returns a String representation of this BindParams.
-
Constructor Details
-
BindParams
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
Create a new BindParams object that will be suitable for a "simple" bind.- Parameters:
bindDN- The bind DN. This may not benull.password- The bind password. This may benull, which would result in a "name-only" bind.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if bindDN isnull.- See Also:
-
BindParams
Create a new BindParams object that will be suitable for a "strong" bind.- Parameters:
identity- Identity to use. May not benull.dsaDN- DSA's DN. This is only used for DAP connections, and so may benull.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if identity isnull- See Also:
-
BindParams
Create a new BindParams object that will be suitable for a "strong" bind over LDAP.- Parameters:
identity- Identity to use. May not benull.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if identity isnull- See Also:
-
BindParams
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 benull.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if saslParameters isnull- See Also:
-
BindParams
Create a new BindParams object which is a copy of an existing one.- Parameters:
otherBindParams- existing BindParams, which must not benull- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native library
-
-
Method Details
-
finalize
Releases any native structures associated with this object. -
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; usenullto 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 isnull.checkCRLs- whether CRL checking should be performed. This value is ignored if ldapHost isnull.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native library
-
getCertificateServerName
Determine the name of the LDAP server used for certificate verification.- Returns:
- a hostname, or
nullif no certificate verification is configured - Throws:
NativeLibraryException- if an unrecoverable error was detected by the native library
-
getCertificateServerPort
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
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
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 benullto clear out any existing identity value.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native library- See Also:
-
setAnonymous
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
Makes this object ready to be used for a simple bind.- Parameters:
bindDN- the bind DN to be used. Must not benull.simplePassword- the password, which may benullfor a "name-only" bind.- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if bindDN isnull.
-
setStrong
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 benull. This will replace any identity already in the BindParams objectdsaDN- the DN to be used, may benullin the case of non-DAP binds- Throws:
NativeLibraryException- if an unrecoverable error was detected by the native libraryNullPointerException- if identity isnull- See Also:
-
setSASL
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 benull. 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 libraryNullPointerException- if saslMech isnull- See Also:
-
getSaslParameters
-
toString
Returns a String representation of this BindParams. -
hashCode
public int hashCode() -
equals
-