Default and LDAP Sample Module

At the Login screen, when user enters the Company Name, User Name and Password and clicks Sign In, the password entered by the user is validated against LDAP server as follows. The password must be entered even if single sign-on is configured for LDAP login module.

User is searched for under the baseDN specified, and if found, the full DN of the user is added to the properties as:

ldapProps.setProperty(Context.SECURITY_PRINCIPAL, dnName);

The password entered by the user is set as java.naming.security.credentials.

ldapProps.put(Context.SECURITY_CREDENTIALS,pPassWd);
LdapHelper ldapHelper = new LdapHelper(ldapProps);

The user is validated using validateByBind. A sample implementation

if (ldapHelper.validateByBind(ldapProps))

{public boolean validateByBind(Hashtable pAttrs)

throws NamingException

{
DirContext ctx = new InitialDirContext(pAttrs);
if (ctx != null)
return true;
return false;
}