Class ConnectionData
java.lang.Object
de.hybris.platform.ldap.connection.ConnectionData
The ConnectionData inner class is used to pass connection data around. Not all fields are guaranteed to be valid
values.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor - data fields are intended to be set directly.ConnectionData(int version, String url, String userDN, char[] pwd, boolean tracing, String referralType, String aliasType) I18nUtility method for test routinesConnectionData(int version, String url, String userDN, char[] pwd, boolean tracing, String referralType, String aliasType, boolean useSSL, String cacerts, String clientcerts, char[] caKeystorePwd, char[] clientKeystorePwd, String caKeystoreType, String clientKeystoreType, boolean useGSSAPI, Properties extraProperties) This sets up a full connection data object with the information needed to create a jndi environment properties object.ConnectionData(LDAPConfigProxyItem config) -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method confirms that the data entered in the ConnectionData object is consistent, complete and valid.voidThis should be used to clear all the passwords saved in this data object when they have been used and are no longer needed...char[]getHost()Gets the host name from the url string.This returns the connection data as a jndi env object suitable for use in opening a directory context.intintintintgetPort()Gets the port number from the url string.getURL()voidputExtraProperty(String key, String property) voidsetProtocol(String newProtocol) static voidsetupBasicProperties(Hashtable env, String url, boolean tracing, String referralType, String aliasType) static voidsetupSimpleSecurityProperties(Hashtable env, String userDN, char[] pwd) This sets the environment properties needed for a simple username + password authenticated jndi connection.static voidsetupSSLProperties(Hashtable env, String cacerts, String clientcerts, char[] caKeystorePwd, char[] clientKeystorePwd, String caKeystoreType, String clientKeystoreType, boolean sslTracing, String sslSocketFactory) voidSets the url from the host & port, e.g.voidSets the url from the host & port, e.g.toString()Returns this data object as a string (doesn't include passwords)..
-
Field Details
-
LDAP
Which protocol to use (currently "ldap", "dsml", "ssl")- See Also:
-
DSML
- See Also:
-
-
Constructor Details
-
ConnectionData
public ConnectionData()Empty constructor - data fields are intended to be set directly. -
ConnectionData
- Throws:
NamingException
-
ConnectionData
public ConnectionData(int version, String url, String userDN, char[] pwd, boolean tracing, String referralType, String aliasType, boolean useSSL, String cacerts, String clientcerts, char[] caKeystorePwd, char[] clientKeystorePwd, String caKeystoreType, String clientKeystoreType, boolean useGSSAPI, Properties extraProperties) This sets up a full connection data object with the information needed to create a jndi environment properties object. Usually you won't need to use the full method, and can use one of the shorter versions that sets empty defaults for the unused bits.- Parameters:
version-url-userDN-pwd-tracing-referralType-aliasType-useSSL-cacerts-clientcerts-caKeystorePwd-clientKeystorePwd-caKeystoreType-clientKeystoreType-useGSSAPI- whether to use the GSSAPI protocol (e.g. for Kerberos support)extraProperties- a 'get out of jail free' for any bizarre properties that haven't already been covered, or that are introduced in the future. Using this isn't really good coding practice, since we don't know what there properties are, but is sometimes required...
-
ConnectionData
public ConnectionData(int version, String url, String userDN, char[] pwd, boolean tracing, String referralType, String aliasType) I18nUtility method for test routines- Parameters:
version-url-userDN-pwd-tracing-referralType-aliasType-
-
-
Method Details
-
setProtocol
-
clearPasswords
public void clearPasswords()This should be used to clear all the passwords saved in this data object when they have been used and are no longer needed... make sure however that no references to the passwords remain to be used by other parts of the program first :-)! (note: since JNDI uses the passwords as Strings, they can still be sniffed from JNDI :-( ). -
setURL
Sets the url from the host & port, e.g. "ldap://" + host + ":" + port". (note: if the protocol is NOT LDAP, (e.g. DSML) this must be set first.- Parameters:
host- the host name to connect to, e.g. schmiedefix or 192.168.145.138.port- the host port to connect to, e.g. 389.
-
setURL
Sets the url from the host & port, e.g. "ldap://" + host + ":" + port". (NB: If the protocol is NOT LDAP, (e.g. DSML) this must be set first.- Parameters:
URL- The full URL to connect to
-
getURL
-
getUserDN
-
getHost
Gets the host name from the url string.- Returns:
- the host name for example: schmiedefix.
-
getPort
public int getPort()Gets the port number from the url string.- Returns:
- the port number for example: 389.
-
getRootDN
-
toString
Returns this data object as a string (doesn't include passwords).. -
getJNDIEnvironment
This returns the connection data as a jndi env object suitable for use in opening a directory context.- Returns:
- jndi environment values
- Throws:
NamingException- a large range of exceptions, ranging from invalid data through to problems setting up the SSL connection.
-
checkData
This method confirms that the data entered in the ConnectionData object is consistent, complete and valid.- Throws:
NamingException- thrown if the data is inconsistent or incomplete.
-
putExtraProperty
-
setupBasicProperties
public static void setupBasicProperties(Hashtable env, String url, boolean tracing, String referralType, String aliasType) throws NamingException - Throws:
NamingException
-
setupSimpleSecurityProperties
This sets the environment properties needed for a simple username + password authenticated jndi connection. It is used by openSimpleSecurityContext(). This method is provided as a convenience for people wishing to append or modify the jndi environment, without setting it up entirely from scratch.- Parameters:
env-userDN-pwd-
-
setupSSLProperties
public static void setupSSLProperties(Hashtable env, String cacerts, String clientcerts, char[] caKeystorePwd, char[] clientKeystorePwd, String caKeystoreType, String clientKeystoreType, boolean sslTracing, String sslSocketFactory) throws NamingException - Throws:
NamingException
-
getMinFailbackTime
public int getMinFailbackTime() -
getMaxRetries
public int getMaxRetries() -
getMaxSize
public int getMaxSize() -
getLDAPEnvironments
-
getCredentials
public char[] getCredentials()
-