* @throws AccountLockedException if locked
*/
public static void checkLogin(User user) throws InvalidLoginCredentialsException, AccountLockedException {
try {
if (!canLogin(user)) {
throw new InvalidLoginCredentialsException("You do not have permission to logon.");
}
if (!isEnabled(user)) {
throw new AccountLockedException(user.getPrincipalName(), "Account locked. Please contact your administrator.",
true, 0);
}
} catch (InvalidLoginCredentialsException lce) {
throw lce;
} catch (AccountLockedException ale) {
throw ale;
} catch (Exception e) {
log.error("Failed to test if logon for " + user.getPrincipalName() + " is allowed.", e);
throw new InvalidLoginCredentialsException("You do not have permission to logon.");
}
}