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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 java.lang.Boolean
checkPassword(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password)
Invokes the configuredPasswordAuthenticator
and returns the result.java.lang.Boolean
doAuth(Buffer buffer, boolean init)
protected java.lang.Boolean
handleClientPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)
Invoked when the client sends aSSH_MSG_USERAUTH_REQUEST
indicating a password change.protected java.lang.Boolean
handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.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
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
doAuth
public java.lang.Boolean doAuth(Buffer buffer, boolean init) throws java.lang.Exception
- Specified by:
doAuth
in classAbstractUserAuth
- Throws:
java.lang.Exception
-
checkPassword
protected java.lang.Boolean checkPassword(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password) throws java.lang.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:
java.lang.Exception
- If internal error during authentication (exception forPasswordChangeRequiredException
which is handled internally)- See Also:
handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
-
handleClientPasswordChangeRequest
protected java.lang.Boolean handleClientPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword) throws java.lang.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:
java.lang.Exception
- If failed to handle the request.
-
handleServerPasswordChangeRequest
protected java.lang.Boolean handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password, PasswordChangeRequiredException e) throws java.lang.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:
java.lang.Exception
- If failed to dispatch the message
-
-