{
public Object run() throws Exception
{
try
{
User user = getUserModule().findUserByUserName(getUsername());
// in case module implementation doesn't throw proper
// exception...
if (user == null)
{
throw new NoSuchUserException("UserModule returned null user object");
}
//This is because LDAP binds can be non case sensitive
if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
&& !getUsername().equals(user.getUserName()))
{
return UserStatus.UNEXISTING;
}
boolean enabled = false;
try {
Object enabledS;
enabledS = getUserProfileModule().getProperty(user,
User.INFO_USER_ENABLED);
if (enabledS != null) {
enabled = new Boolean(enabledS.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
if (!enabled) {
return UserStatus.DISABLE;
}
if (havingRole != null)
{
boolean hasTheRole = false;
Set roles = getMembershipModule().getRoles(user);
for (Iterator i = roles.iterator(); i.hasNext();)
{
Role role = (Role)i.next();
if (havingRole.equals(role.getName()))
{
hasTheRole = true;
break;
}
}
if (!hasTheRole)
{
return UserStatus.NOTASSIGNEDTOROLE;
}
}
if (!user.validatePassword(inputPassword))
{
return UserStatus.WRONGPASSWORD;
}
}
catch (NoSuchUserException e1)