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 PasswordAuthenticator
Used to authenticate users based on a password.- Author:
- Apache MINA SSHD Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
authenticate(String username, String password, ServerSession session)
Check the validity of a password.default boolean
handleClientPasswordChangeRequest(ServerSession session, String username, String oldPassword, String newPassword)
Invoked when the client sends aSSH_MSG_USERAUTH_REQUEST
indicating a password change.
-
-
-
Method Detail
-
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
- TheServerSession
attempting the authentication- Returns:
true
indicating 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_REQUEST
indicating a password change. This can happen if theauthenticate
method threwPasswordChangeRequiredException
thus telling the client that it needs to provide a new password. ThrowsUnsupportedOperationException
by default.- Parameters:
session
- TheServerSession
attempting the authenticationusername
- The username credentialoldPassword
- The old passwordnewPassword
- The new password- Returns:
true
if password change accepted
-
-