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 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 protected Boolean
checkPassword(Buffer buffer, ServerSession session, String username, String password)
Invokes the configuredPasswordAuthenticator
and returns the result.Boolean
doAuth(Buffer buffer, boolean init)
protected Boolean
handleClientPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String oldPassword, String newPassword)
Invoked when the client sends aSSH_MSG_USERAUTH_REQUEST
indicating a password change.protected Boolean
handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String password, PasswordChangeRequiredException e)
Invoked bycheckPassword(Buffer, ServerSession, String, String)
when aPasswordChangeRequiredException
was thrown by the authenticator.-
Methods inherited from class org.apache.sshd.server.auth.AbstractUserAuth
auth, destroy, getName, getServerSession, getService, getSession, getUsername, next, toString
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
-
-
-
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:
doAuth
in classAbstractUserAuth
- Throws:
Exception
-
checkPassword
protected Boolean checkPassword(Buffer buffer, ServerSession session, String username, String password) throws Exception
Invokes the configuredPasswordAuthenticator
and returns the result. IfPasswordChangeRequiredException
thrown by the authenticator thenhandleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
is invoked- Parameters:
buffer
- The receivedBuffer
to be re-used if need to send a password change requestsession
- TheServerSession
through which the request was receivedusername
- The usernamepassword
- The password- Returns:
- The authentication result - if
null
then exception was handled internally and authentication is still in progress - Throws:
Exception
- If internal error during authentication (exception forPasswordChangeRequiredException
which 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_REQUEST
indicating a password change. ThrowsUnsupportedOperationException
by default- Parameters:
buffer
- TheBuffer
to re-use in order to respondsession
- The associatedServerSession
username
- The usernameoldPassword
- The old passwordnewPassword
- The new password- Returns:
- Password change and authentication result -
null
means 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 aPasswordChangeRequiredException
was thrown by the authenticator. By default it re-throws the original exception.- Parameters:
buffer
- The receivedBuffer
to be re-used if need to send a password change requestsession
- TheServerSession
through which the request was receivedusername
- The usernamepassword
- The (rejected) passworde
- The original thrown exception- Returns:
null
by default to indicate incomplete authentication- Throws:
Exception
- If failed to dispatch the message
-
-