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
public class UserAuthPassword extends AbstractUserAuth
Implements the server-side "password" authentication mechanism- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAME-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Constructor Summary
Constructors Constructor Description UserAuthPassword()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BooleancheckPassword(Buffer buffer, ServerSession session, String username, String password)Invokes the configuredPasswordAuthenticatorand returns the result.BooleandoAuth(Buffer buffer, boolean init)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 Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
doAuth
public Boolean doAuth(Buffer buffer, boolean init) throws Exception
- 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:
handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
-
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
-
-