Class UserAuthPassword
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.auth.AbstractUserAuth
org.apache.sshd.server.auth.password.UserAuthPassword
- All Implemented Interfaces:
UserAuthInstance<ServerSession>,UsernameHolder,NamedResource,UserAuth,ServerSessionHolder
Implements the server-side "password" authentication mechanism
-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BooleancheckPassword(Buffer buffer, ServerSession session, String username, String password) Invokes the configuredPasswordAuthenticatorand returns the result.protected BooleanhandleClientPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String oldPassword, String newPassword) Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change.protected BooleanhandleServerPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String password, PasswordChangeRequiredException e) Invoked bycheckPassword(Buffer, ServerSession, String, String)when aPasswordChangeRequiredExceptionwas thrown by the authenticator.Methods inherited from class org.apache.sshd.server.auth.AbstractUserAuth
auth, destroy, getName, getServerSession, getService, getSession, getUsername, next, toString
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
UserAuthPassword
public UserAuthPassword()
-
-
Method Details
-
doAuth
- Specified by:
doAuthin classAbstractUserAuth- Throws:
Exception
-
checkPassword
protected Boolean checkPassword(Buffer buffer, ServerSession session, String username, String password) throws Exception Invokes the configuredPasswordAuthenticatorand returns the result. IfPasswordChangeRequiredExceptionthrown by the authenticator thenhandleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)is invoked- Parameters:
buffer- The receivedBufferto be re-used if need to send a password change requestsession- TheServerSessionthrough which the request was receivedusername- The usernamepassword- The password- Returns:
- The authentication result - if
nullthen exception was handled internally and authentication is still in progress - Throws:
Exception- If internal error during authentication (exception forPasswordChangeRequiredExceptionwhich is handled internally)- See Also:
-
handleClientPasswordChangeRequest
protected Boolean handleClientPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String oldPassword, String newPassword) throws Exception Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change. ThrowsUnsupportedOperationExceptionby default- Parameters:
buffer- TheBufferto re-use in order to respondsession- The associatedServerSessionusername- The usernameoldPassword- The old passwordnewPassword- The new password- Returns:
- Password change and authentication result -
nullmeans authentication incomplete - i.e., handler has sent some extra query. - Throws:
Exception- If failed to handle the request.
-
handleServerPasswordChangeRequest
protected Boolean handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String password, PasswordChangeRequiredException e) throws Exception Invoked bycheckPassword(Buffer, ServerSession, String, String)when aPasswordChangeRequiredExceptionwas thrown by the authenticator. By default it re-throws the original exception.- Parameters:
buffer- The receivedBufferto be re-used if need to send a password change requestsession- TheServerSessionthrough which the request was receivedusername- The usernamepassword- The (rejected) passworde- The original thrown exception- Returns:
nullby default to indicate incomplete authentication- Throws:
Exception- If failed to dispatch the message
-