Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void something() {
- String userName = "username";
- String password = "password";
- LdapContext ctx = null;
- try {
- Hashtable<String, String> env = new Hashtable<String, String>();
- env.put(Context.INITIAL_CONTEXT_FACTORY,
- "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.SECURITY_AUTHENTICATION, "Simple");
- env.put(Context.SECURITY_PRINCIPAL, userName+"@something.net");
- env.put(Context.SECURITY_CREDENTIALS,password);
- env.put(Context.PROVIDER_URL, "some url");
- ctx = new InitialLdapContext(env, null);
- }
Add Comment
Please, Sign In to add comment