title: Using ldapRegistry properties in Java running on Liberty Profile
body: <p>I have some Java code running on Liberty Profile which authenticates with MS Active Directory and makes LDAP searches. The code use JNDI and does what it is intended to do. The problem is that the LDAP parameters are hard coded in Java. Works, but could be improved:</p>
  
  <pre><code>ldap.put(Context.PROVIDER_URL,  "ldap://ad.foo.bar:389");
  ldap.put(Context.SECURITY_PRINCIPAL, "CN=account,OU=A,DC=ad,DC=foo,DC=bar");
  ldap.put(Context.SECURITY_CREDENTIALS, "apoorlykeptsecret");
  ...
  ldapCtxt = new InitialDirContext(ldap);
  </code></pre>
  
  <p>Is it possible to pick the LDAP properties up from an ldapRegistry element in the server.xml file instead? Or am I on the wrong track? Is there a better way to approach this?</p>