PublickeyAuthenticator authenticator = session.getServerFactoryManager().getPublickeyAuthenticator();
if (authenticator == null) {
throw new Exception("No PublickeyAuthenticator configured");
}
if (!authenticator.authenticate(username, key, session)) {
return false;
}
if (!hasSig) {
Buffer buf = session.createBuffer(SshConstants.Message.SSH_MSG_USERAUTH_PK_OK, 0);
buf.putString(alg);