if (authenticationFailure.getCondition() instanceof Failure.NotAuthorized) {
throw new FailedLoginException(failureText);
} else if (authenticationFailure.getCondition() instanceof Failure.AccountDisabled) {
throw new AccountLockedException(failureText);
} else if (authenticationFailure.getCondition() instanceof Failure.CredentialsExpired) {
throw new CredentialExpiredException(failureText);
} else {
throw new LoginException(saslClient.getMechanismName() + " authentication failed with condition: " + (authenticationFailure.getCondition() != null ? authenticationFailure.getCondition().getClass().getSimpleName() : "unknown"));
}
} else {
throw new LoginException(saslClient.getMechanismName() + " authentication failed for an unknown reason, but probably due to timeout.");