Interface PasswordAuthenticator
-
- All Known Implementing Classes:
AcceptAllPasswordAuthenticator,JaasPasswordAuthenticator,RejectAllPasswordAuthenticator,StaticPasswordAuthenticator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface PasswordAuthenticatorUsed to authenticate users based on a password.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanauthenticate(java.lang.String username, java.lang.String password, ServerSession session)Check the validity of a password.default booleanhandleClientPasswordChangeRequest(ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change.
-
-
-
Method Detail
-
authenticate
boolean authenticate(java.lang.String username, java.lang.String password, ServerSession session) throws PasswordChangeRequiredException, AsyncAuthExceptionCheck the validity of a password.- Parameters:
username- The username credentialpassword- The provided passwordsession- TheServerSessionattempting the authentication- Returns:
trueindicating if authentication succeeded- Throws:
PasswordChangeRequiredException- If the password is expired or not strong enough to suit the server's policyAsyncAuthException- If the authentication is performed asynchronously
-
handleClientPasswordChangeRequest
default boolean handleClientPasswordChangeRequest(ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)
Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change. This can happen if theauthenticatemethod threwPasswordChangeRequiredExceptionthus telling the client that it needs to provide a new password. ThrowsUnsupportedOperationExceptionby default.- Parameters:
session- TheServerSessionattempting the authenticationusername- The username credentialoldPassword- The old passwordnewPassword- The new password- Returns:
trueif password change accepted
-
-