Top Description Fields Constructors Methods
org.apache.sshd.server.auth.password

public Class UserAuthPassword

extends AbstractUserAuth
Class Inheritance
Imports
org.apache.sshd.common.RuntimeSshException, .SshConstants, org.apache.sshd.common.auth.UserAuthMethodFactory, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.server.auth.AbstractUserAuth, org.apache.sshd.server.session.ServerSession

Implements the server-side "password" authentication mechanism
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Boolean

Returns:

The authentication result - if null then exception was handled internally and authentication is still in progress
checkPassword
(Buffer
The received Buffer to be re-used if need to send a password change request
buffer
,
ServerSession
The ServerSession through which the request was received
session
,
String
The username
username
,
String
The password
password
)

Invokes the configured PasswordAuthenticator and returns the result.

public Boolean
doAuth(Buffer buffer, boolean init)

Implements abstract org.apache.sshd.server.auth.AbstractUserAuth.doAuth.

protected Boolean

Returns:

Password change and authentication result - null means authentication incomplete - i.e., handler has sent some extra query.
handleClientPasswordChangeRequest
(Buffer
The Buffer to re-use in order to respond
buffer
,
ServerSession
The associated ServerSession
session
,
String
The username
username
,
String
The old password
oldPassword
,
String
The new password
newPassword
)

Invoked when the client sends a SSH_MSG_USERAUTH_REQUEST indicating a password change.

protected Boolean

Returns:

null by default to indicate incomplete authentication
handleServerPasswordChangeRequest
(Buffer
The received Buffer to be re-used if need to send a password change request
buffer
,
ServerSession
The ServerSession through which the request was received
session
,
String
The username
username
,
String
The (rejected) password
password
,
PasswordChangeRequiredException
The original thrown exception
e
)

Invoked by checkPassword(Buffer, ServerSession, String, String) when a PasswordChangeRequiredException was thrown by the authenticator.

Inherited from org.apache.sshd.server.auth.AbstractUserAuth:
authdestroygetNamegetServerSessiongetServicegetSessiongetUsernamenexttoString

Field Detail

NAMEback to summary
public static final String NAME

Constructor Detail

UserAuthPasswordback to summary
public UserAuthPassword()

Method Detail

checkPasswordback to summary
protected Boolean checkPassword(Buffer buffer, ServerSession session, String username, String password) throws Exception

Invokes the configured PasswordAuthenticator and returns the result. If PasswordChangeRequiredException thrown by the authenticator then handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException) is invoked

Parameters
buffer:Buffer

The received Buffer to be re-used if need to send a password change request

session:ServerSession

The ServerSession through which the request was received

username:String

The username

password:String

The password

Returns:Boolean

The authentication result - if null then exception was handled internally and authentication is still in progress

Exceptions
Exception:
If internal error during authentication (exception for PasswordChangeRequiredException which is handled internally)
See Also
handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
doAuthback to summary
public Boolean doAuth(Buffer buffer, boolean init) throws Exception

Implements abstract org.apache.sshd.server.auth.AbstractUserAuth.doAuth.

Annotations
@Override
handleClientPasswordChangeRequestback to summary
protected Boolean handleClientPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String oldPassword, String newPassword) throws Exception

Invoked when the client sends a SSH_MSG_USERAUTH_REQUEST indicating a password change. Throws UnsupportedOperationException by default

Parameters
buffer:Buffer

The Buffer to re-use in order to respond

session:ServerSession

The associated ServerSession

username:String

The username

oldPassword:String

The old password

newPassword:String

The new password

Returns:Boolean

Password change and authentication result - null means authentication incomplete - i.e., handler has sent some extra query.

Exceptions
Exception:
If failed to handle the request.
handleServerPasswordChangeRequestback to summary
protected Boolean handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, String username, String password, PasswordChangeRequiredException e) throws Exception

Invoked by checkPassword(Buffer, ServerSession, String, String) when a PasswordChangeRequiredException was thrown by the authenticator. By default it re-throws the original exception.

Parameters
buffer:Buffer

The received Buffer to be re-used if need to send a password change request

session:ServerSession

The ServerSession through which the request was received

username:String

The username

password:String

The (rejected) password

e:PasswordChangeRequiredException

The original thrown exception

Returns:Boolean

null by default to indicate incomplete authentication

Exceptions
Exception:
If failed to dispatch the message