Skip to main content

Posts

Showing posts from December, 2015

best practices for java authentication via LDAP

/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package com.dash.ejb.login; import java.util.Hashtable; import javax.naming.AuthenticationException; import javax.naming.Context; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.SizeLimitExceededException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; public class MyLdapAuthinticator {     private static String LDAP_SERVER="ldap server ip";     private static String LDAP_SERVER_PORT="ldap server port";     private static String LDAP_BASE_DN="dc=domain name,dc=com";     private static String LDAP_BIND_DN="CN=ldap power user,CN