Class ConnectionData

java.lang.Object
de.hybris.platform.ldap.connection.ConnectionData

public class ConnectionData extends Object
The ConnectionData inner class is used to pass connection data around. Not all fields are guaranteed to be valid values.

  • Field Details

  • Constructor Details

    • ConnectionData

      public ConnectionData()
      Empty constructor - data fields are intended to be set directly.
    • ConnectionData

      public ConnectionData(LDAPConfigProxyItem config) throws NamingException
      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

      public void setProtocol(String newProtocol)
    • 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

      public void setURL(String host, int port)
      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

      public void setURL(String URL)
      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

      public String getURL()
    • getUserDN

      public String getUserDN()
    • getHost

      public String 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

      public String getRootDN()
    • toString

      public String toString()
      Returns this data object as a string (doesn't include passwords)..
      Overrides:
      toString in class Object
      Returns:
      the data object as a string.
    • getJNDIEnvironment

      public Hashtable getJNDIEnvironment() throws NamingException
      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

      public void checkData() throws NamingException
      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

      public void putExtraProperty(String key, String property)
    • setupBasicProperties

      public static void setupBasicProperties(Hashtable env, String url, boolean tracing, String referralType, String aliasType) throws NamingException
      Throws:
      NamingException
    • setupSimpleSecurityProperties

      public static void setupSimpleSecurityProperties(Hashtable env, String userDN, char[] pwd)
      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

      public List<Hashtable<String,String>> getLDAPEnvironments()
    • getCredentials

      public char[] getCredentials()