if (username.equals(this.anonymousUser))
{
throw new LoginException("Anonymous user cannot login");
}
JetspeedUser user = null;
BasicAttributes attr= new BasicAttributes();
String[] attrs = {"ou", "userPassword", "uid", "mail"};
String dN = null;
username = JetspeedSecurity.convertUserName(username);
password = JetspeedSecurity.convertPassword(password);
try
{
user = JetspeedUserManagement.getUser(new UserNamePrincipal(username));
}
catch (UnknownUserException e)
{
throw new FailedLoginException(e.toString());
}
catch (JetspeedSecurityException e)
{
throw new LoginException(e.toString());
}
if(!LDAPUserManagement.passwordsMatch(user, password))
{
throw new FailedLoginException("Credential authentication failure");
}
// Mark the user as being logged in.
user.setHasLoggedIn(new Boolean(true));
// Store the clear-text password to session if some of the
// portlets need it (for example to single-signon functionality)
user.setTemp( "sessionPassword", password );
// Set the last_login date in the database.
try
{
user.updateLastLogin();
putUserIntoContext(user);
if (cachingEnable)
{
JetspeedSecurityCache.load(username);