}
if (keyPairProvider != null) {
log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
KeyPair pair = keyPairProvider.loadKey(getKeyType());
authResult = session.authPublicKey(getUsername(), pair);
} else {
log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
authResult = session.authPassword(getUsername(), getPassword());
}