public class UserAuthPassword extends AbstractUserAuth
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
log
BY_NAME_COMPARATOR, NAME_EXTRACTOR
Constructor and Description |
---|
UserAuthPassword() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Boolean |
checkPassword(Buffer buffer,
ServerSession session,
java.lang.String username,
java.lang.String password)
Invokes the configured
PasswordAuthenticator 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 a
SSH_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 by
checkPassword(Buffer, ServerSession, String, String)
when a PasswordChangeRequiredException was thrown by the authenticator. |
auth, destroy, getName, getServerSession, getService, getSession, getUsername, next, toString
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findByName, getNameList, getNames, ofName, removeByName
public static final java.lang.String NAME
public java.lang.Boolean doAuth(Buffer buffer, boolean init) throws java.lang.Exception
doAuth
in class AbstractUserAuth
java.lang.Exception
protected java.lang.Boolean checkPassword(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password) throws java.lang.Exception
PasswordAuthenticator
and returns the result.
If PasswordChangeRequiredException
thrown by the authenticator then
handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
is invokedbuffer
- The received Buffer
to be re-used if need to send
a password change requestsession
- The ServerSession
through which the request was receivedusername
- The usernamepassword
- The passwordnull
then exception was handled
internally and authentication is still in progressjava.lang.Exception
- If internal error during authentication (exception for
PasswordChangeRequiredException
which is handled internally)handleServerPasswordChangeRequest(Buffer, ServerSession, String, String, PasswordChangeRequiredException)
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
SSH_MSG_USERAUTH_REQUEST
indicating
a password change. Throws UnsupportedOperationException
by defaultbuffer
- The Buffer
to re-use in order to respondsession
- The associated ServerSession
username
- The usernameoldPassword
- The old passwordnewPassword
- The new passwordnull
means
authentication incomplete - i.e., handler has sent some extra query.java.lang.Exception
- If failed to handle the request.protected java.lang.Boolean handleServerPasswordChangeRequest(Buffer buffer, ServerSession session, java.lang.String username, java.lang.String password, PasswordChangeRequiredException e) throws java.lang.Exception
checkPassword(Buffer, ServerSession, String, String)
when a PasswordChangeRequiredException
was thrown by the authenticator.
By default it re-throws the original exception.buffer
- The received Buffer
to be re-used if need to send
a password change requestsession
- The ServerSession
through which the request was receivedusername
- The usernamepassword
- The (rejected) passworde
- The original thrown exceptionnull
by default to indicate incomplete authenticationjava.lang.Exception
- If failed to dispatch the message