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.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 java.lang.BooleancheckPassword(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password)Invokes the configuredPasswordAuthenticatorand returns the result.java.lang.BooleandoAuth(Buffer buffer, boolean init)protected java.lang.BooleanhandleClientPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String oldPassword, java.lang.String newPassword)Invoked when the client sends aSSH_MSG_USERAUTH_REQUESTindicating a password change.protected java.lang.BooleanhandleServerPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.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 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:
doAuthin 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 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:
java.lang.Exception- If internal error during authentication (exception forPasswordChangeRequiredExceptionwhich 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_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:
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 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:
java.lang.Exception- If failed to dispatch the message
-
-