Class BindProfile
- All Implemented Interfaces:
Comparable<BindProfile>
Arbitrary information may be stored in the profile using either
profileSettings or multiValuedSettings.
The class provides a number of methods to create a bound directory
session. In all these cases, DSAPI's certificate validation checks are
disabled for the bind, and instead any certificate presented by a server is
checked using information from the BindProfile (see
verifySessionCertificates(DirectorySession)). Normally, a
certificate verification failure will result in the bind failing with
an NotBoundException, but by using
bind(CommonArgs, boolean), a caller may specify that any failure to
verify certificates should result in the bind operation succeeding, with
a list of the certificates being returned to the caller for further
verification. So, for example, an interactive application may wish to
present certificates to the user so that he can decide whether or not to
continue.
Implementation note on versioning
BindProfile objects are typically, but not always, associated with a
BindProfileList. BindProfileList objects have a version which is used to
determine their file format, and this may affect which bits of a BindProfile
can be loaded/saved. Specifically, when adding new functionality to a
BindProfile that is incompatible with earlier BindProfileList implementations,
implementors must consider whether the minimumBPLVersion variable
should be updated.
For example, if the field "SASLMech" is added to BindProfile, and the BindProfileList class is updated so that it saves and loads "SASLMech", then the code in this class would say something like:
public void setSASLMech(String mech) {
// Requires at least BPL version 2
minimumBPLVersion = Math.max(minimumBPLVersion,2);
...
}
so that an attempt to save a BindProfile with a "SASLMech"
into a "v1" BindProfileList on disk will fail. When the BindProfileList
loads in BindProfiles, it should use these "set" methods, so the version
info will automatically be kept correct.
If any new fields are added to the BindProfile class, the copy constructor
BindProfile(BindProfile) must be updated to copy those
fields.
- Author:
- nh
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConvenience class used to encapsulate the result of creating and binding to a Directory. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessPointprotected DNprotected final BindProfileAddressprotected BindTypeWill be one of ANONYMOUS, SIMPLE or STRONG.protected booleanprotected Stringprotected Stringprotected DNContains a collection of XML chunks that appeared inside the "dsa" tag for this BindProfile but were not parsed because they were unrecognised.protected booleanprotected intThe minimum version of the BindProfileList implementation which could be used to save this object.Public HashMap of HashSets associated with the BindProfile.Common arguments to be associated with this Bind Profile.Public HashMap associated with this Bind Profile.protected Stringprotected DNprotected Identityprotected FileThis keeps a track of all the stale identities associated with this bind profile that gets generated as a result of modification to identity again and again. -
Constructor Summary
ConstructorsModifierConstructorDescriptionBindProfile(BindProfile orig) Create a new BindProfile as a copy of an existing BindProfile.BindProfile(BindProfileAddress bindProfileAddress) Create a BindProfile representing an anonymous connection.protectedBindProfile(BindProfileAddress bindProfileAddress, DN dsaDN, DN bindDN, DN userDN, SASLParametersProfile saslparams, BindType bindType) Constructor used by BindProfileList and other constructors in this class to create a new object.BindProfile(BindProfileAddress bindProfileAddress, DN dsaDN, DN userDN, String identityPassphrase, Identity identity) Create a new BindProfile object which will use strong authentication.BindProfile(BindProfileAddress bindProfileAddress, DN bindDN, String password) Create a bind profile based on simple authentication.BindProfile(BindProfileAddress bindProfileAddress, SASLParametersProfile saslParams) Create a BindProfile representing a connection using SASL authentication. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributes(Collection<AttributeBlock> blocks) Adds the givenCollectionofAttributeBlockto the bind profiles attributes list.Add the given certificate to trust store of the bind profileConvenience method to create an anonymously bound IsodeDirectorySession from this object, for callers who are not interested in specifying any bind CommonArgs, or obtaining a bind Indication.anonymousBind(CommonArgs bindCommonArgs) Create and bind new IsodeDirectorySession from this object, but regardless of the embedded bindType, this method will perform only an anonymous bind.anonymousBind(CommonArgs bindCommonArgs, boolean callerCanVerify) Create and bind new IsodeDirectorySession from this object, but regardless of the embedded bindType, this method will perform only an anonymous bind.Get an iterator over all the AttributeBlocksbind()Convenience method to create a new IsodeDirectorySession from this object, for callers who are not interested in specifying any bind CommonArgs, or obtaining a bind Indication, or doing any certificate verification themselves.bind(CommonArgs bindCommonArgs) Convenience method to create and bind new IsodeDirectorySession from this object.bind(CommonArgs bindCommonArgs, boolean callerCanVerify) Performs a bind of the type appropriate for the bind profile.bindWithTrace(CommonArgs bindCommonArgs, boolean callerCanVerify, com.isode.nettrace.observers.NettraceObserver observer) Creates a traced bind (a bind with aNettraceattached) of the type appropriate for the bind profile.voidclearAttributeBlocks(String type) Remove all AttributeBlocks of a given type from the bind profilevoidclearAttributesOfType(String type) Remove allAttributeBlockof the given typevoidRemove all trusted certificates from bind profileintcompareTo(BindProfile bb) Compare ordering for list display.voidCopies the the extra xml from another bind profile into this one (any extra xml for this bind profile will be overwritten).voidCopies the unique id from another bind profile.booleanDetermine whether this BindProfile knows about (that is, it trusts) a particular certificate.voidgenerateIdentity(Identity identity, String idPassphrase) Generate an internal Isode specific P12 identity for the given X.509 identity.voidgenerateIdentity(Identity identity, String idPassphrase, boolean deleteOldFile) Generate an internal Isode specific P12 identity for the given X.509 identity.getAP()Returns the access point associated with this BindProfile, if there is one.Gets a list of all the attribute blocks in the bind profile.getAttributeBlocks(String type) Get a list of AttributeBlocks with a specific type fieldReturns the bindDN associated with this object (simple bind)Determine the BindProfileAddress for this objectDetermine the type of bind associated with this object.Gets the DSA directory associated with this BindProfile.getDsaDN()Determine the DSA DN associated with this object.Return a String containing any "extra" XML (tags and contents) that were contained in this BindProfile's definition but were not recognised.Returns the passphrase used to decrypt the X.509 identity file associated with this BindProfile.Get the name of the Isode Specific Identity File Name that had been generated using the methodgenerateIdentity(Identity, String).Returns the known DSA DN associated with this BindProfile.Returns the known DSA presentation address associated with this BindProfile.getPorts()Get the port numbers which appear to be referenced by the addresses in this BindProfile.Determine the SASL parameters associated with this BindProfile.Gets the Windows service name or Solaris FMRI associated with this BindProfile.getSetting(String key) Read a setting from the profileSettings.Get the password that will be used when performing a simple bind.getTag()Get the XML tag which should be used when writing this Bind Profile to file.Get the list of trusted certificates for this bind profileGet the list of trusted certificates for this bind profileGets the unique id for the bind profile if it is set, if it is not set generate one then returns that.Gets the unique ID for the bind profile if it is set.Return the userDN associated with this object (strong bind)Return the X.509 Identity associated with this object (strong bind).booleanhasAnySetting(String... keys) Indicates if the profile has a a setting for any of the given keys.booleanhasAnySetting(Collection<String> keys) Indicates if the profile has a a setting for any of the given keys.booleanhasSetting(String key) Indicates if the profile has a setting for the given key.booleanIndicates if the bind profile has a unique id set for it.booleanReturns whether this Bind Profile is bindable.booleanTest whether this is a DSA bind profile or not.booleanReturns the managed flag associated with this BindProfile.booleanDetermine whether this BindProfile appears to be associated with a managed DSA on the local system.booleanDetermine whether a password must be provided when this BindProfile is used to make a connection.booleanIndicates if a unique id is set for the bind profileintmultiValueCount(String key) Get the number of values for the given multi value key.multiValueIterator(String key) Return an iterator over a specific set of multivalues in the bind profile.Return an iterator over all the available multiValued settings in the bind profile.booleanDetermine whether password data was removed from this object when it was loaded from a BindProfileList.voidputAttributeBlock(AttributeBlock block) Add an AttributeBlock to the bind profilevoidputMultiValuedSetting(String key, String value) Add or update the list of values associated with a specific multivalued setting in the bind profile.voidputSetting(String key, String value) Put or change a setting in the profileSettings.voidremoveIdentity(String identityFileNameOrPath) Remove the identity from the identities specific directory when a bind profile is removed or savedvoidRemove trusted certificate from bind profile and trust store with the given keyvoidreplaceAttributesOfType(String type, Collection<AttributeBlock> blocks) Removes allAttributeBlockof the given type from the bind profiles attribute list then appends the givenCollectionofAttributeBlockto the end of the list.voidsetAttributes(Collection<? extends AttributeBlock> blocks) Clear all existing AttributeBlocks and replace with new setvoidsetBindable(boolean canBind) Sets the bindable flag associated with this BindProfile.voidSet the bind DN associated with this object, for a simple bind.voidsetDisplayName(String displayName) Sets the DSA directory associated with this BindProfile.final voidsetIdentity(Identity identity) Set the x509Identity for this BindProfile.final voidsetIdentityPassphrase(String newPassphrase) Set the passphrase used to decrypt the X.509 identity file associated with this BindProfile.voidsetKnownDsaDetails(AccessPoint ap, boolean managed) Sets the known DSA details associated with this BindProfile.voidsetServiceName(String name) Sets the Windows service name or Solaris FMRI associated with this BindProfile.final voidsetSimpleBindPassword(String password) Change the "simple bind" password associated with this object.voidSet XML tag to be used when writing to disc.protected voidsetUniqueID(String value) Sets the unique id for the bind profile.toString()Return a user-friendly String representation of this object.booleanuniqueIDEquals(String id) Indicates if the bind profiles unique id is set to the given value.x509VerifyCertificate(SSLCertificate certificate) Call the X.509 library to perform certificate verification using parameters stored in this BindProfile.x509VerifyCertificate(SSLCertificate certificate, List<SSLCertificate> trustAnchors, List<SSLCertificate> otherCerts) Call the X.509 library to perform certificate verification with CRL checking using parameters stored in this BindProfile.
-
Field Details
-
minimumBPLVersion
protected int minimumBPLVersionThe minimum version of the BindProfileList implementation which could be used to save this object. By default this is V1, but when a feature is added to this class which requires extra support from the BPL, the corresponding setter method will need to update the field.This field is read directly by
BindProfileList.saveConfiguration()- no getter method is provided. -
displayName
-
bindProfileAddress
-
dsaDN
-
bindDN
-
userDN
-
ap
-
managed
protected boolean managed -
canBind
protected boolean canBind -
dsaDir
-
serviceName
-
x509Identity
-
x509IdentityFileName
-
x509StaleIdsForBpList
This keeps a track of all the stale identities associated with this bind profile that gets generated as a result of modification to identity again and again. These identities would be deleted when the bind profile is saved. -
extraXML
Contains a collection of XML chunks that appeared inside the "dsa" tag for this BindProfile but were not parsed because they were unrecognised. -
profileCommonArgs
Common arguments to be associated with this Bind Profile. When a new session is created using bind(), the new IsodeDirectorySession object will contain a reference to this object in its defaultCommonArgs.- See Also:
-
profileSettings
Public HashMap associated with this Bind Profile. This is used to store application-specific settings associated with the profile. The HashMap should only contain String->String key->value mappings.- See Also:
-
multiValuedSettings
Public HashMap of HashSets associated with the BindProfile. This is used to store application-specific settings for multi-valued settings associated with the profile.- Since:
- 14.4
- See Also:
-
bindType
Will be one of ANONYMOUS, SIMPLE or STRONG.
-
-
Constructor Details
-
BindProfile
Create a new BindProfile as a copy of an existing BindProfile.This constructor does not copy the access point (the DSA DN of which needs to be unique among all bind profiles in a list) and the managed flag (which can be true only if the access point is present).
- Parameters:
orig- The originalBindProfileto copy
-
BindProfile
protected BindProfile(BindProfileAddress bindProfileAddress, DN dsaDN, DN bindDN, DN userDN, SASLParametersProfile saslparams, BindType bindType) throws IllegalArgumentException Constructor used by BindProfileList and other constructors in this class to create a new object. It is expected that the caller will use various "set" methods to set up other fields.- Parameters:
bindProfileAddress- the BindProfileAddress of the DSA. This must not benulldsaDN- the DSA's DN (required for strong binds)bindDN- the bindDN (simple bind)userDN- the userDN (strong bind)saslparams- a reference to the SASLParameters object to be used in the case of a SASL bind. This parameter is ignored unless bindType is SASL, in which case it must not benull. This method makes a copy of saslparams.bindType- one of ANONYMOUS, SIMPLE, STRONG or SASL- Throws:
IllegalArgumentException- if- bindType is invalid
- presentationAddress is null
- bindDN is null when bindType is SIMPLE
- dsaDN is null when bindType is STRONG
- saslMech is null when bindType is SASL
- Since:
- 14.6
-
BindProfile
public BindProfile(BindProfileAddress bindProfileAddress, DN bindDN, String password) throws IllegalArgumentException Create a bind profile based on simple authentication.- Parameters:
bindProfileAddress- the bindProfileAddress representing the DSA. Must not benull.bindDN- the bindDN. Must not benull.password- the password associated with bindDN. This may benull, in which case a password will have to be provided when a bind is attempted using this BindProfile.- Throws:
IllegalArgumentException- if presentationAddress, bindDN or password isnull
-
BindProfile
public BindProfile(BindProfileAddress bindProfileAddress, DN dsaDN, DN userDN, String identityPassphrase, Identity identity) throws IllegalArgumentException Create a new BindProfile object which will use strong authentication.- Parameters:
bindProfileAddress- the BindProfileAddress of the DSA. Must not benull.dsaDN- the DSA's DN (must not benull)userDN- the userDN (may benull)identityPassphrase- the passphrase to decrypt the user's identity file on the local system. This may benull, in which case a password will have to be provided when a bind is attempted using this BindProfile.identity- X509 Identity that will be used in Strong Binds- Throws:
IllegalArgumentException- if presentationAddress, dsaDN or password isnull.
-
BindProfile
Create a BindProfile representing an anonymous connection.- Parameters:
bindProfileAddress- the BindProfileAddress of the DSA. Must not benull.- Throws:
IllegalArgumentException- if presentationAddress isnull.
-
BindProfile
Create a BindProfile representing a connection using SASL authentication.- Parameters:
bindProfileAddress- the BindProfileAddress of the DSA. Must not benull.saslParams- a reference to an existing SASLParameters. The constructor makes a copy of this object, and so subsequent changes to the object used in this call will not affect the parameters used for a subsequent bind operation. Callers wishing to examine or update the SASLParameters associated with a BindProfile should usegetSASLParameters()to obtain a reference to the active set of parameters.- Since:
- 14.6
- See Also:
-
-
Method Details
-
bind
public BindProfile.BoundSession bind(CommonArgs bindCommonArgs) throws DSAPIException, NativeLibraryException Convenience method to create and bind new IsodeDirectorySession from this object. The returned value contains both the IsodeDirectorySession and the Indication that was returned as a result of the bind operation.Typically, bindCommonArgs are used to request password policy information (see
RequestPasswordPolicy) and so are unrelated to any CommonArgs associated with the BindProfile. Setting this parameter tonullcauses a default set of CommonArgs to be used (seedefault CommonArgs).Note that applications interested in password policy should consider handling
IndicationExceptionsthat are thrown by this method: such exceptions will contain a reference to anIndicationwhich may contain password policy information relevant to the bind failure (e.g. "password expired").This method will throw a
NotBoundExceptionif the server presents certificates which are not trusted.- Parameters:
bindCommonArgs- common arguments to be used for the bind operation. If this isnull, then default CommonArgs will be used.- Returns:
- a
BoundSessionobject. - Throws:
DSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- See Also:
-
bind
Convenience method to create a new IsodeDirectorySession from this object, for callers who are not interested in specifying any bind CommonArgs, or obtaining a bind Indication, or doing any certificate verification themselves.This method will throw a
NotBoundExceptionif the server presents certificates which are not trusted.- Returns:
- a bound IsodeDirectorySession.
- Throws:
DSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- See Also:
-
bind
public BindProfile.BoundSession bind(CommonArgs bindCommonArgs, boolean callerCanVerify) throws DSAPIException, NativeLibraryException Performs a bind of the type appropriate for the bind profile. This method allows a caller to specify whether or not he is capable of performing certificate verification himself.Any certificates that are returned by the server will be verified using
verifySessionCertificates(DirectorySession).If verification fails, then the behaviour of the method in this case depends on the setting of the callerCanVerify flag.
If callerCanVerify is false then connection will be dropped, and a
NotBoundExceptionwill be thrown.If callerCanVerify is true then
BindProfile.BoundSessionobject returned by this method will contain aDirectorySession.SessionCertificatesobject which the caller is expected to use to perform his own verification (e.g. by showing them to the user and asking if they're OK).- Parameters:
bindCommonArgs- common arguments to be used for the bind operation. If this isnull, then default CommonArgs will be used (with disableVerification turned on).callerCanVerify- true if the caller is able to perform certificate verification, false otherwise.- Returns:
- a
BoundSessionobject. If callerCanVerify was set to true then the caller must check in here to see if any SessionCertificates are present, and handle them appropriately. - Throws:
NotBoundException- if the server presents certificates that are not listed in the bind profile, and callerCanVerify was set to falseDSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- Since:
- 14.6
-
bindWithTrace
public BindProfile.BoundSession bindWithTrace(CommonArgs bindCommonArgs, boolean callerCanVerify, com.isode.nettrace.observers.NettraceObserver observer) throws DSAPIException, NativeLibraryException Creates a traced bind (a bind with aNettraceattached) of the type appropriate for the bind profile. This method allows a caller to specify whether or not he is capable of performing certificate verification himself.Any certificates that are returned by the server will be verified using
verifySessionCertificates(DirectorySession).If verification fails, then the behavior of the method in this case depends on the setting of the callerCanVerify flag.
If callerCanVerify is false then connection will be dropped, and a
NotBoundExceptionwill be thrown.If callerCanVerify is true then
BindProfile.BoundSessionobject returned by this method will contain aDirectorySession.SessionCertificatesobject which the caller is expected to use to perform his own verification (e.g. by showing them to the user and asking if they're OK).- Parameters:
bindCommonArgs- common arguments to be used for the bind operation. If this isnull, then default CommonArgs will be used (with disableVerification turned on).callerCanVerify- true if the caller is able to perform certificate verification, false otherwise.observer- aNettraceObserverto register with theNettrace. It will receives all messagesNettracereceives and decodes.- Returns:
- a
BoundSessionobject. If callerCanVerify was set to true then the caller must check in here to see if any SessionCertificates are present, and handle them appropriately. - Throws:
NotBoundException- if the server presents certificates that are not listed in the bind profile, and callerCanVerify was set to falseDSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- Since:
- 16.0
-
anonymousBind
public BindProfile.BoundSession anonymousBind(CommonArgs bindCommonArgs) throws DSAPIException, NativeLibraryException Create and bind new IsodeDirectorySession from this object, but regardless of the embedded bindType, this method will perform only an anonymous bind.This method is typically useful in cases where a
BindProfileListhas been loaded without a passphrase having been specified, in which case the resultant BindProfiles are likely not to have valid passwords, and so can't be used with the normalbindmethod.The returned value contains both the IsodeDirectorySession and the Indication that was returned as a result of the bind operation.
Typically, bindCommonArgs are used to request password policy information (see
RequestPasswordPolicy) and so are unrelated to any CommonArgs associated with the BindProfile. Setting this parameter to null causes a default set of CommonArgs to be used (seedefault CommonArgs).Note that applications interested in password policy should consider handling
IndicationExceptionsthat are thrown by this method: such exceptions will contain a reference to anIndicationwhich may contain password policy information relevant to the bind failure (e.g. "password expired").This method will throw a
NotBoundExceptionif the server presents certificates which are not trusted. UseanonymousBind(CommonArgs, boolean)for greater control over what happens in this situation.- Parameters:
bindCommonArgs- common arguments to be used for the bind operation. If this isnull, then default CommonArgs will be used.- Returns:
- a
BoundSessionobject. - Throws:
DSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- See Also:
-
anonymousBind
Convenience method to create an anonymously bound IsodeDirectorySession from this object, for callers who are not interested in specifying any bind CommonArgs, or obtaining a bind Indication.This method will throw a
NotBoundExceptionif the server presents certificates which are not trusted. UseanonymousBind(CommonArgs, boolean)for greater control over what happens in this situation.- Returns:
- a bound IsodeDirectorySession.
- Throws:
DSAPIException- if the bind failsNativeLibraryException- if an unrecoverable error was detected by the native library.- See Also:
-
anonymousBind
public BindProfile.BoundSession anonymousBind(CommonArgs bindCommonArgs, boolean callerCanVerify) throws DSAPIException Create and bind new IsodeDirectorySession from this object, but regardless of the embedded bindType, this method will perform only an anonymous bind.This method is typically useful in cases where a
BindProfileListhas been loaded without a passphrase having been specified, in which case the resultant BindProfiles are likely not to have valid passwords, and so can't be used with the normalbindmethod.The returned value contains both the IsodeDirectorySession and the Indication that was returned as a result of the bind operation, as well as SessionCertificates (if certificate verification failed and the user specified callerCanVerify).
Typically, bindCommonArgs are used to request password policy information (see
RequestPasswordPolicy) and so are unrelated to any CommonArgs associated with the BindProfile. Setting this parameter to null causes a default set of CommonArgs to be used (seedefault CommonArgs).Note that applications interested in password policy should consider handling
IndicationExceptionsthat are thrown by this method: such exceptions will contain a reference to anIndicationwhich may contain password policy information relevant to the bind failure (e.g. "password expired").- Parameters:
bindCommonArgs- common arguments to be used for the bind operation. If this isnull, then default CommonArgs will be used.callerCanVerify- true if the caller is able to perform certificate verification, false otherwise.- Returns:
- a BoundSession if the bind was successful.
- Throws:
DSAPIException- Since:
- 14.6
-
setBindDN
Set the bind DN associated with this object, for a simple bind.- Parameters:
bindDN- to set- Throws:
IllegalArgumentException- if anullDN is passed
-
getBindDN
Returns the bindDN associated with this object (simple bind)- Returns:
- the bindDN.
-
getUserDN
Return the userDN associated with this object (strong bind)- Returns:
- the bindDN.
-
getBindType
Determine the type of bind associated with this object.- Returns:
- one of ANONYMOUS, SIMPLE, or STRONG
-
getDsaDN
Determine the DSA DN associated with this object. This value is only meaningful when strong authentication is being used.- Returns:
- the dsaDN
-
getBindProfileAddress
Determine the BindProfileAddress for this object- Returns:
- the BindProfileAddress. This will never be
null. - Since:
- 15.0
-
setSimpleBindPassword
Change the "simple bind" password associated with this object. Subsequent simple bind operations will use the new password. If password isnull, then a password will need to be supplied when using this BindProfile to perform a simple bind.- Parameters:
password- the password to used for simple binds, ornullif no simple bind password is to be associated with this BindProfile.- Since:
- 14.6
- See Also:
-
getSimpleBindPassword
Get the password that will be used when performing a simple bind. Note this method replaces "getPassword"- Returns:
- the simple bind password, or
nullif there isn't one. - Since:
- 14.6
-
getSASLParameters
Determine the SASL parameters associated with this BindProfile. This method returns a reference to the active set of parameters being used, and so changes made to it will affect subsequent bind operations.- Returns:
- the SASL parameters, or
nullif this is not a BindProfile that's got a bindType of SASL. - Since:
- 14.6
-
toString
Return a user-friendly String representation of this object. -
getDisplayName
- Returns:
- Returns the displayName.
-
setDisplayName
- Parameters:
displayName- The displayName to set.
-
putSetting
Put or change a setting in the profileSettings. These are application-specific key-value pairs stored by the bind profile.- Parameters:
key- Keyvalue- Value, ornullto delete the setting
-
putMultiValuedSetting
Add or update the list of values associated with a specific multivalued setting in the bind profile.- Parameters:
key- keyvalue- the value to be associated with key. Usenullto remove all settings associated with key.- Since:
- 14.4
-
putAttributeBlock
Add an AttributeBlock to the bind profile- Parameters:
block- AttributeBlock to add which must not be null- Since:
- 16.6
-
getAttributeBlocks
Get a list of AttributeBlocks with a specific type field- Parameters:
type- The type of AttributeBlock to return, which must not be null- Returns:
- List of AttributeBlocks which will never be null
- Since:
- 16.6
-
getAttributeBlocks
Gets a list of all the attribute blocks in the bind profile.- Returns:
- A list of all the attribute blocks in the bind profile.
- Since:
- 17.0
-
clearAttributeBlocks
Remove all AttributeBlocks of a given type from the bind profile- Parameters:
type- Type to remove, which must not be null- Since:
- 16.6
-
attributeBlockIterator
Get an iterator over all the AttributeBlocks- Returns:
- iterator, which will never be null
- Since:
- 16.6
-
setAttributes
Clear all existing AttributeBlocks and replace with new set- Parameters:
blocks- replacement collection of AttributeBlocks, which may be null- Since:
- 16.6
-
clearAttributesOfType
Remove allAttributeBlockof the given type- Parameters:
type- Type ofAttributeBlockto remove, allAttributeBlockof this type will be removed from the bind profiles attributes. Can benull.- Since:
- 17.0
-
addAttributes
Adds the givenCollectionofAttributeBlockto the bind profiles attributes list. The added blocks will be appended to the end of the attribute list in the order they are returned by theCollection's iterator.- Parameters:
blocks- TheCollectionofAttributeBlockto add, should not benull- Since:
- 17.0
-
replaceAttributesOfType
Removes allAttributeBlockof the given type from the bind profiles attribute list then appends the givenCollectionofAttributeBlockto the end of the list.- Parameters:
type- The type ofAttributeBlockto remove. Can benullblocks- TheCollectionof
-
getSetting
Read a setting from the profileSettings. These are application-specific key-value pairs stored by the bind profile.- Parameters:
key- Key- Returns:
- Value, or
nullif not found
-
hasSetting
Indicates if the profile has a setting for the given key.- Parameters:
key- A key to check.- Returns:
trueif the profile has a setting for that key,falseotherwise.- Since:
- 17.0
-
hasAnySetting
Indicates if the profile has a a setting for any of the given keys.- Parameters:
keys- ACollectionof keys, should not benull- Returns:
trueif their exists a value for at least one of the keys,falseotherwise.- Since:
- 17.0
-
hasAnySetting
Indicates if the profile has a a setting for any of the given keys.- Parameters:
keys- List of keys.- Returns:
trueif their exists a value for at least one of the keys,falseotherwise.- Since:
- 17.0
-
multiValueSettingsIterator
Return an iterator over all the available multiValued settings in the bind profile. The Strings returned can be used to obtain values, withmultiValueIterator(String)- Returns:
- an Iterator which will be empty if no values are present.
- Since:
- 14.4
- See Also:
-
multiValueIterator
Return an iterator over a specific set of multivalues in the bind profile.- Parameters:
key- the key- Returns:
- an Iterator which will be empty if no values match key.
- Since:
- 14.4
- See Also:
-
multiValueCount
Get the number of values for the given multi value key.- Parameters:
key- key string, not null- Returns:
- number of values (0 or more)
-
compareTo
Compare ordering for list display.- Specified by:
compareToin interfaceComparable<BindProfile>
-
isPasswordRequired
public boolean isPasswordRequired()Determine whether a password must be provided when this BindProfile is used to make a connection.- Returns:
- true for a SIMPLE BindProfile that has no simpleBindPassword, or for a STRONG BindProfile that has no identityPassphrase.
-
setIdentity
Set the x509Identity for this BindProfile. A copy is made of the supplied Identity (so if callers subsequently muck about with the Identity, it won't affect the value stored in this object). The caller is responsible for making sure that the BindProfile's identityPassphrase is consistent with this value.- Parameters:
identity- Identity object, which may benull.- Since:
- 14.6
- See Also:
-
getX509Identity
Return the X.509 Identity associated with this object (strong bind).- Returns:
- X.509 Identity
-
removeIdentity
Remove the identity from the identities specific directory when a bind profile is removed or saved- Parameters:
identityFileNameOrPath- full path of identity file or filename if the identity exists in the identify specific directory- Since:
- 16.3
-
generateIdentity
public void generateIdentity(Identity identity, String idPassphrase, boolean deleteOldFile) throws IOException Generate an internal Isode specific P12 identity for the given X.509 identity. The Isode specific identity will have a generated name ,will be protected with a random passphrase and stored internally in Isode specific directory.Any P12 file that was previously referred to by this BindProfile object will be left alone, unless deleteOldFile is set to true, in which case it will be marked for deletion which means it will be deleted when bind profile list are saved. This may be helpful if there is a chance that something other than this bind profile has a reference to the P12 file in question (e.g. an older version of "isode-bindprofile.xml"
- Parameters:
identity- X.509 IdentityidPassphrase- passphrase for the given identitydeleteOldFile- true to make sure that any P12 file previously referred to by the object will be deleted.- Throws:
IOException- if Isode specific identity could not be generated with the new passphrase- Since:
- 15.0
-
generateIdentity
Generate an internal Isode specific P12 identity for the given X.509 identity. The Isode specific identity will have a generated name ,will be protected with a random passphrase and stored internally in Isode specific directory.Usually, it is desirable not to leave "orphan" identities lying around and so this method will mark for deletion any P12 file that had previously been "owned" by this bind profile. To prevent this happening, use
generateIdentity(Identity, String, boolean)- Parameters:
identity- X.509 IdentityidPassphrase- passphrase for the given identity- Throws:
IOException- if Isode specific identity could not be generated with the new passphrase- Since:
- 14.6
- See Also:
-
getIsodeX509IdentityFileName
Get the name of the Isode Specific Identity File Name that had been generated using the methodgenerateIdentity(Identity, String).- Returns:
- name of the generated X.509 Identity File,
or
nullif there is none. - Since:
- 14.6
-
doesTrustCertificate
Determine whether this BindProfile knows about (that is, it trusts) a particular certificate. This method does not perform full certificate validation, just checks to see whether the specified certificate is listed in the bind profile.- Parameters:
cert- the certificate to check- Returns:
- true if the BindProfile trusts cert, or false if it doesn't.
- Since:
- 14.6
-
getTrustedCerts
Get the list of trusted certificates for this bind profile- Returns:
- list of trusted certificates, not null but can be empty and the list will contain only non-null values
- Since:
- 16.3
-
getTrustedCertsWithKeys
Get the list of trusted certificates for this bind profile- Returns:
- list of trusted certificates, not null but can be empty. It is possible to have null certificates for keys if the certificate is not found in the trust store
- Since:
- 16.3
-
clearTrustedCerts
Remove all trusted certificates from bind profile- Throws:
IOException- if there was an error while initialising the trust store- Since:
- 16.3
-
addCertificateToBpTrustStore
Add the given certificate to trust store of the bind profile- Parameters:
cert- certificate to add, not null- Returns:
- key with which the certificate is referred in bind profile, not null
- Throws:
IOException- if there was an error writing certificate to trust store- Since:
- 16.3
-
removeTrustedCertFromBp
Remove trusted certificate from bind profile and trust store with the given key- Parameters:
key- key used for referring the trusted certificate, not null- Throws:
IOException- if there was an error in removing certificate from trust store- Since:
- 16.3
-
x509VerifyCertificate
Call the X.509 library to perform certificate verification using parameters stored in this BindProfile.This method uses the
CertificateVerifierclass to verify the specified certificate, using- trustAnchors consisting of the trust anchors defined by the BindProfile's trustStore which the BindProfile trusts
- otherCerts defined by the BindProfile's identity
- ldapHost
- ldapPort
- checkCRL
- Parameters:
certificate- certificate to be verified- Returns:
- a VerifyResult containing the result of the verification, (which the caller can look in to see whether verification worked)
- Throws:
CryptoException- an error occurred when trying to perform verification- Since:
- 14.6
-
x509VerifyCertificate
public VerifyResult x509VerifyCertificate(SSLCertificate certificate, List<SSLCertificate> trustAnchors, List<SSLCertificate> otherCerts) throws CryptoException Call the X.509 library to perform certificate verification with CRL checking using parameters stored in this BindProfile.This method uses the
CertificateVerifierclass to verify the specified certificate, using- trustAnchors
- otherCerts
- ldapHost
- ldapPort
- Parameters:
certificate- certificate to be verifiedtrustAnchors- trust anchors to be used for certificate verification, can be nullotherCerts- other certificates to be used for certificate verification, can be null- Returns:
- a VerifyResult containing the result of the verification, (which the caller can look in to see whether verification worked)
- Throws:
CryptoException- an error occurred when trying to perform verification- Since:
- 16.3
-
getExtraXML
Return a String containing any "extra" XML (tags and contents) that were contained in this BindProfile's definition but were not recognised. This data will be re-written to the file if it is saved.- Returns:
- a String containing all the XML which was not parsed,
or
nullif there was none. - Since:
- 14.6
- See Also:
-
getIdentityPassphrase
Returns the passphrase used to decrypt the X.509 identity file associated with this BindProfile.- Returns:
- p12 passphrase
- Since:
- 14.6
-
setIdentityPassphrase
Set the passphrase used to decrypt the X.509 identity file associated with this BindProfile.- Parameters:
newPassphrase- new passphrase- Since:
- 14.6
- See Also:
-
passwordDataRemoved
public boolean passwordDataRemoved()Determine whether password data was removed from this object when it was loaded from a BindProfileList.When loading a BindProfileList in "readonly" mode (i.e. without specifying a passphrase), any passwords in the BindProfileList are ignored (because they cannot be decrypted) and the BindProfile objects will have null values. However, it may be useful for an application to know whether a password was present, because that would imply it would be worth re-loading the BindProfileList in read/write mode to obtain those passwords.
- Returns:
- true if this object was
- loaded from a read-only BindProfileList, and
- one or more (encrypted) passwords was removed when it was read
- Since:
- 14.6
-
getKnownDsaPA
Returns the known DSA presentation address associated with this BindProfile. This value will be null unless the BindProfile has an access point.- Returns:
- known DSA presentation address,
or
nullif there is none. - Since:
- 15.0
-
getKnownDsaDN
Returns the known DSA DN associated with this BindProfile. This value will benullunless the BindProfile has an access point.- Returns:
- known DSA DN, or
nullif there is none. - Since:
- 15.0
-
getAP
Returns the access point associated with this BindProfile, if there is one.- Returns:
- access point, or
nullif there is none. - Since:
- 15.0
-
isManaged
public boolean isManaged()Returns the managed flag associated with this BindProfile.- Returns:
- managed flag
- Since:
- 15.0
-
isBindable
public boolean isBindable()Returns whether this Bind Profile is bindable.- Returns:
- bindable flag - TRUE if profile contains reliable bind profile address, FALSE otherwise
- Since:
- 15.0
-
setKnownDsaDetails
Sets the known DSA details associated with this BindProfile.- Parameters:
ap- Access point, can benullmanaged- Managed flag- Throws:
IllegalArgumentException- if managed flag is true when access point isnull.- Since:
- 15.0
-
setBindable
public void setBindable(boolean canBind) Sets the bindable flag associated with this BindProfile.- Parameters:
canBind- Bindable flag- Since:
- 15.0
-
setDsadir
Sets the DSA directory associated with this BindProfile.- Parameters:
dsaDir- DSA directory (usenullto mean no value)- Returns:
- the previous setting (which may be
null) - Since:
- 15.0
-
getDsadir
Gets the DSA directory associated with this BindProfile.- Returns:
- String representation of the DSA's directory,
or
nullif no DSA directory has been set. - Since:
- 15.0
-
setServiceName
Sets the Windows service name or Solaris FMRI associated with this BindProfile.- Parameters:
name- Windows service name or Solaris FMRI (usenullto mean not used on Windows or Solaris)- Since:
- 15.0
-
getServiceName
Gets the Windows service name or Solaris FMRI associated with this BindProfile.- Returns:
- String representation of the Windows service name or Solaris
FMRI, or
nullif none has been set. - Since:
- 15.0
-
getPorts
Get the port numbers which appear to be referenced by the addresses in this BindProfile. The method returns port numbers that appear in either the BindProfileAddress or the Presentation Address (if they are non-null).Note that this method is "best efforts" - it may not always be possible to deduce all the port numbers from the address. Additionally, some types of BindProfile (e.g. "xmpp://...") don't have port numbers at all.
The intention is that this method can be used as a way of suggesting to the user which port numbers may be in use already (e.g. "you appear to have a bind profile which uses port xxxx") rather than as a way of getting definitive information.
- Returns:
- a Set of Integers representing port numbers that are referenced by the addresses in this bind profile. This will be an empty set if no port numbers were found.
- Since:
- 15.0
-
isManagedOnLocalSystem
public boolean isManagedOnLocalSystem()Determine whether this BindProfile appears to be associated with a managed DSA on the local system.The return value of the method should be fairly reliable although it may not be correct if the user is using a bind profile file which has been copied from another system, or if he has edited the bind profile file, or if he has deleted the DSA's directory.
- Returns:
- true if this is a managed DSA that has a DSA directory which exists on this system, false otherwise.
- Since:
- 15.0
-
getTag
Get the XML tag which should be used when writing this Bind Profile to file.- Returns:
- tag XML tag value which will not be
null - Since:
- 15.2
-
setTag
Set XML tag to be used when writing to disc.- Parameters:
tag- tag value to use which must not benull- Since:
- 15.2
-
isDsaBindProfile
public boolean isDsaBindProfile()Test whether this is a DSA bind profile or not.- Returns:
- true if this profile is one for a DSA, false otherwise
- Since:
- 15.2
-
getUniqueIDIfSet
Gets the unique ID for the bind profile if it is set. -
getUniqueIDAndGenerate
Gets the unique id for the bind profile if it is set, if it is not set generate one then returns that.- Returns:
- The unique id for the bind profile.
-
isUniqueIDSet
public boolean isUniqueIDSet()Indicates if a unique id is set for the bind profile- Returns:
trueif a unique id is set for the bind profile,falseotherwise.
-
uniqueIDEquals
Indicates if the bind profiles unique id is set to the given value.- Parameters:
id- The value to compare the bind profile's id to, ifnullresult will befalse.- Returns:
trueif the unique id is set and equal to the given value,falseotherwise.
-
hasUniqueIDSet
public boolean hasUniqueIDSet()Indicates if the bind profile has a unique id set for it.- Returns:
trueif the bind profile has a unique id set for it,falseotherwise.
-
setUniqueID
Sets the unique id for the bind profile.- Parameters:
value- The value to set the unique id to. Ifnullno id will be cleared.
-
copyUniqueID
Copies the unique id from another bind profile. (any existing id for this bind profile will be overwritten)- Parameters:
bp- The bind profile to copy the id from, ifnullor if it does not have an unique id then the unique id for this bind profile will be cleared.- Since:
- 17.0
-
copyExtraXML
Copies the the extra xml from another bind profile into this one (any extra xml for this bind profile will be overwritten).- Parameters:
bp- theBindProfileto copy the bind profile from.- Since:
- 17.0
-