{
userManager.updateUser( user );
}
}
return new AuthenticationResult( true, source.getUsername(), null );
}
catch ( MustChangePasswordException e )
{
user.setPasswordChangeRequired( true );
//throw e;
resultException = e;
authnResultErrors.add( new AuthenticationFailureCause(
AuthenticationConstants.AUTHN_MUST_CHANGE_PASSWORD_EXCEPTION, e.getMessage() ).user( user ) );
}
}
else
{
log.warn( "Password is Invalid for user {} and userManager '{}'.", source.getUsername(),
userManager.getId() );
authnResultErrors.add( new AuthenticationFailureCause( AuthenticationConstants.AUTHN_NO_SUCH_USER,
"Password is Invalid for user "
+ source.getUsername() + "." ).user( user ) );
try
{
securityPolicy.extensionExcessiveLoginAttempts( user );
}
finally
{
if ( !userManager.isReadOnly() )
{
userManager.updateUser( user );
}
}
//return new AuthenticationResult( false, source.getUsername(), null, authnResultExceptionsMap );
}
}
catch ( UserNotFoundException e )
{
log.warn( "Login for user {} and userManager {} failed. user not found.", source.getUsername(),
userManager.getId() );
resultException = e;
authnResultErrors.add( new AuthenticationFailureCause( AuthenticationConstants.AUTHN_NO_SUCH_USER,
"Login for user " + source.getUsername()
+ " failed. user not found." ) );
}
catch ( Exception e )
{
log.warn( "Login for user {} and userManager {} failed, message: {}", source.getUsername(),
userManager.getId(), e.getMessage() );
resultException = e;
authnResultErrors.add( new AuthenticationFailureCause( AuthenticationConstants.AUTHN_RUNTIME_EXCEPTION,
"Login for user " + source.getUsername()
+ " failed, message: " + e.getMessage() ) );
}
}
return new AuthenticationResult( authenticationSuccess, username, resultException, authnResultErrors );
}