Class UserAuthPassword
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.auth.AbstractUserAuth
-
- org.apache.sshd.client.auth.password.UserAuthPassword
-
- All Implemented Interfaces:
UserAuth
,ClientSessionHolder
,UserAuthInstance<ClientSession>
,NamedResource
public class UserAuthPassword extends AbstractUserAuth
Implements the client-side "password" authentication mechanism- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static String
NAME
-
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 void
init(ClientSession session, String service)
protected boolean
processAuthDataRequest(ClientSession session, String service, Buffer buffer)
protected String
resolveAttemptedPassword(ClientSession session, String service)
protected boolean
sendAuthDataRequest(ClientSession session, String service)
protected IoWriteFuture
sendPassword(Buffer buffer, ClientSession session, String oldPassword, String newPassword)
Sends the password via aSSH_MSG_USERAUTH_REQUEST
message.void
signalAuthMethodFailure(ClientSession session, String service, boolean partial, List<String> serverMethods, Buffer buffer)
Signals reception ofSSH_MSG_USERAUTH_FAILURE
messagevoid
signalAuthMethodSuccess(ClientSession session, String service, Buffer buffer)
Signal reception ofSSH_MSG_USERAUTH_SUCCESS
message-
Methods inherited from class org.apache.sshd.client.auth.AbstractUserAuth
destroy, getClientSession, getName, getService, getSession, process, toString
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(ClientSession session, String service) throws Exception
- Specified by:
init
in interfaceUserAuth
- Overrides:
init
in classAbstractUserAuth
- Parameters:
session
- TheClientSession
service
- The requesting service name- Throws:
Exception
- If failed to initialize the mechanism
-
sendAuthDataRequest
protected boolean sendAuthDataRequest(ClientSession session, String service) throws Exception
- Specified by:
sendAuthDataRequest
in classAbstractUserAuth
- Throws:
Exception
-
resolveAttemptedPassword
protected String resolveAttemptedPassword(ClientSession session, String service) throws Exception
- Throws:
Exception
-
processAuthDataRequest
protected boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception
- Specified by:
processAuthDataRequest
in classAbstractUserAuth
- Throws:
Exception
-
sendPassword
protected IoWriteFuture sendPassword(Buffer buffer, ClientSession session, String oldPassword, String newPassword) throws Exception
Sends the password via aSSH_MSG_USERAUTH_REQUEST
message. If old and new password are not the same then it requests a password modification from the server (which may be denied if the server does not support this feature).- Parameters:
buffer
- TheBuffer
to re-use for sending the messagesession
- The targetClientSession
oldPassword
- The previous passwordnewPassword
- The new password- Returns:
- An
IoWriteFuture
that can be used to wait and check on the success/failure of the request packet being sent - Throws:
Exception
- If failed to send the message.
-
signalAuthMethodSuccess
public void signalAuthMethodSuccess(ClientSession session, String service, Buffer buffer) throws Exception
Description copied from interface:UserAuth
Signal reception ofSSH_MSG_USERAUTH_SUCCESS
message- Parameters:
session
- TheClientSession
service
- The requesting service namebuffer
- TheBuffer
containing the success message (after having consumed the relevant data from it)- Throws:
Exception
- If failed to handle the callback - Note: may cause session close
-
signalAuthMethodFailure
public void signalAuthMethodFailure(ClientSession session, String service, boolean partial, List<String> serverMethods, Buffer buffer) throws Exception
Description copied from interface:UserAuth
Signals reception ofSSH_MSG_USERAUTH_FAILURE
message- Parameters:
session
- TheClientSession
service
- The requesting service namepartial
-true
if some partial authentication success so farserverMethods
- TheList
of authentication methods that can continuebuffer
- TheBuffer
containing the failure message (after having consumed the relevant data from it)- Throws:
Exception
- If failed to handle the callback - Note: may cause session close
-
-