public class PublicKeyAuthentication<C extends Context> extends java.lang.Object implements AuthenticationMechanism
AuthenticationMechanism that enables the public key
authentication. The current implementation will look for an
authorized_keys file in the users home directory which is returned
from the
com.maverick.sshd.platform.NativeAuthenticationProvider#getHomeDirectory(String)
method. The format of this file is identical to that required by OpenSSH.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTHENTICATION_METHOD |
static int |
SSH_MSG_USERAUTH_PK_OK |
| Constructor and Description |
|---|
PublicKeyAuthentication(AbstractServerTransport<C> transport,
AbstractAuthenticationProtocol<C> authentication,
SshConnection con,
PublicKeyAuthenticationProvider[] providers) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getMethod()
Return the SSH method name for this authentication.
|
boolean |
processMessage(byte[] msg)
If the SSH protocol authentication method defines additional messages
which are sent from the client, they will be passed into your
implementation here when received.
|
boolean |
startRequest(java.lang.String username,
byte[] msg)
Start an authentication transaction.
|
public static final int SSH_MSG_USERAUTH_PK_OK
public static final java.lang.String AUTHENTICATION_METHOD
public PublicKeyAuthentication(AbstractServerTransport<C> transport, AbstractAuthenticationProtocol<C> authentication, SshConnection con, PublicKeyAuthenticationProvider[] providers)
public java.lang.String getMethod()
AuthenticationMechanismgetMethod in interface AuthenticationMechanismpublic boolean startRequest(java.lang.String username,
byte[] msg)
throws java.io.IOException
AuthenticationMechanismcom.maverick.sshd.AuthenticationProtocol instance that was passed
in the initialization process. The request data varies according to the
authentication method.
if (success)
authentication.completedAuthentication(method, username, service);
else
authentication.failedAuthentication(method);
startRequest in interface AuthenticationMechanismmsg - the request data from the SSH_MSG_USERAUTH_REQUEST messagejava.io.IOExceptionpublic boolean processMessage(byte[] msg)
throws java.io.IOException
AuthenticationMechanismprocessMessage in interface AuthenticationMechanismjava.io.IOExceptionCopyright © 2022. All rights reserved.