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.
Used to authenticate users based on a password.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(String username, String password, ServerSession session) Check the validity of a password.default booleanhandleClientPasswordChangeRequest(ServerSession session, String username, String oldPassword, String newPassword) Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change.
-
Method Details
-
authenticate
boolean authenticate(String username, String password, ServerSession session) throws PasswordChangeRequiredException, AsyncAuthException Check 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, String username, String oldPassword, 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
-