@FunctionalInterface
public interface PasswordAuthenticator
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(java.lang.String username,
java.lang.String password,
ServerSession session)
Check the validity of a password.
|
default boolean |
handleClientPasswordChangeRequest(ServerSession session,
java.lang.String username,
java.lang.String oldPassword,
java.lang.String newPassword)
Invoked when the client sends a
SSH_MSG_USERAUTH_REQUEST indicating a password change. |
boolean authenticate(java.lang.String username, java.lang.String password, ServerSession session) throws PasswordChangeRequiredException, AsyncAuthException
username
- The username credentialpassword
- The provided passwordsession
- The ServerSession
attempting the authenticationtrue
indicating if authentication succeededPasswordChangeRequiredException
- If the password is expired or not strong enough to suit the server's
policyAsyncAuthException
- If the authentication is performed asynchronouslydefault boolean handleClientPasswordChangeRequest(ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)
SSH_MSG_USERAUTH_REQUEST
indicating a password change. This can happen if
the authenticate
method threw PasswordChangeRequiredException
thus telling the client that it
needs to provide a new password. Throws UnsupportedOperationException
by default.session
- The ServerSession
attempting the authenticationusername
- The username credentialoldPassword
- The old passwordnewPassword
- The new passwordtrue
if password change accepted