SSHD: Create user instance only once during authentication

Change-Id: I91c26d1ac9211c6cdb6bf391ace1416d290d343b
This commit is contained in:
David Ostrovsky 2014-02-16 19:44:15 +01:00
parent a145270984
commit 7953027df2

View File

@ -140,14 +140,13 @@ class DatabasePubKeyAuth implements PublickeyAuthenticator {
}
}
if (!SshUtil.createUser(sd, userFactory, key.getAccount())
.getAccount().isActive()) {
IdentifiedUser cu = SshUtil.createUser(sd, userFactory, key.getAccount());
if (!cu.getAccount().isActive()) {
sd.authenticationError(username, "inactive-account");
return false;
}
return SshUtil.success(username, session, sshScope, sshLog, sd,
SshUtil.createUser(sd, userFactory, key.getAccount()));
return SshUtil.success(username, session, sshScope, sshLog, sd, cu);
}
private Set<PublicKey> getPeerKeys() {