Guest User

Untitled

a guest
Dec 6th, 2018
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public void something() {
  2. String userName = "username";
  3. String password = "password";
  4. LdapContext ctx = null;
  5. try {
  6. Hashtable<String, String> env = new Hashtable<String, String>();
  7. env.put(Context.INITIAL_CONTEXT_FACTORY,
  8. "com.sun.jndi.ldap.LdapCtxFactory");
  9. env.put(Context.SECURITY_AUTHENTICATION, "Simple");
  10. env.put(Context.SECURITY_PRINCIPAL, userName+"@something.net");
  11. env.put(Context.SECURITY_CREDENTIALS,password);
  12. env.put(Context.PROVIDER_URL, "some url");
  13. ctx = new InitialLdapContext(env, null);
  14. }
Add Comment
Please, Sign In to add comment