Top Description Fields Constructors Methods
org.apache.sshd.client.session

public Class ClientUserAuthService

extends AbstractCloseable
implements Service, ClientSessionHolder
Class Inheritance
All Implemented Interfaces
org.apache.sshd.client.session.ClientSessionHolder, org.apache.sshd.common.Service, org.apache.sshd.common.Closeable, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable, org.apache.sshd.common.PropertyResolver, org.apache.sshd.common.session.SessionHolder, org.apache.sshd.common.session.SessionContextHolder
Imports
java.io.IOException, java.util.ArrayList, .Arrays, .Collections, .List, .Map, java.util.concurrent.ConcurrentHashMap, java.util.concurrent.atomic.AtomicReference, org.apache.sshd.client.auth.UserAuth, .UserAuthFactory, org.apache.sshd.client.auth.keyboard.UserInteraction, org.apache.sshd.client.auth.pubkey.UserAuthPublicKey, org.apache.sshd.client.future.AuthFuture, .DefaultAuthFuture, org.apache.sshd.common.NamedResource, .RuntimeSshException, .Service, .SshConstants, .SshException, org.apache.sshd.common.auth.UserAuthMethodFactory, org.apache.sshd.common.future.CancelFuture, .DefaultCancelFuture, org.apache.sshd.common.io.IoWriteFuture, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.closeable.AbstractCloseable, org.apache.sshd.core.CoreModuleProperties

Client side ssh-auth service.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
protected final List<UserAuthFactory>
protected final AtomicReference<AuthFuture>
authFutureHolder

The AuthFuture that is being used by the current auth request.

protected final List<String>
protected final ClientSessionImpl
private int
private UserAuth
private Runnable
private final Object
private final Map<String, Object>
private UserAuth
protected List<String>
private String
private boolean
Inherited from org.apache.sshd.common.util.closeable.AbstractCloseable:
closeFuturefutureLockstate

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AuthFuture
auth(String service)

private void
protected AuthFuture
private void
private void
public ClientSession
public String
public Map<String, Object>
getProperties()

Implements org.apache.sshd.common.PropertyResolver.getProperties.

A map of properties that can be used to configure the SSH server or client.

public ClientSession
protected void
preClose()

Overrides org.apache.sshd.common.util.closeable.AbstractCloseable.preClose.

preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.

public void
process(int
The incoming command type
cmd
,
Buffer
The Buffer containing optional command parameters
buffer
)

Implements org.apache.sshd.common.Service.process.

Service the request.

protected void
processUserAuth(int
the command
cmd
,
Buffer
the input Buffer, with the reading position after the command byte
buffer
,
AuthFuture authFuture)

Execute one step in user authentication.

protected IoWriteFuture
public void
protected void
tryNext(int cmd, AuthFuture authFuture)

protected AuthFuture
Inherited from org.apache.sshd.common.util.closeable.AbstractCloseable:
addCloseFutureListenerbuilderclosedoCloseGracefullydoCloseImmediatelygetFutureLockisClosedisClosingremoveCloseFutureListener

Field Detail

authFactoriesback to summary
protected final List<UserAuthFactory> authFactories
authFutureHolderback to summary
protected final AtomicReference<AuthFuture> authFutureHolder

The AuthFuture that is being used by the current auth request. It is set while an authentication is ongoing.

clientMethodsback to summary
protected final List<String> clientMethods
clientSessionback to summary
protected final ClientSessionImpl clientSession
currentMethodback to summary
private int currentMethod
currentUserAuthback to summary
private UserAuth currentUserAuth
initialRequestSenderback to summary
private Runnable initialRequestSender
initLockback to summary
private final Object initLock
propertiesback to summary
private final Map<String, Object> properties
pubkeyAuthback to summary
private UserAuth pubkeyAuth
serverMethodsback to summary
protected List<String> serverMethods
serviceback to summary
private String service
startedback to summary
private boolean started

Constructor Detail

ClientUserAuthServiceback to summary
public ClientUserAuthService(Session s)

Method Detail

authback to summary
public AuthFuture auth(String service) throws IOException
clearUserAuthback to summary
private void clearUserAuth()
createAuthFutureback to summary
protected AuthFuture createAuthFuture(ClientSession session, String service) throws IOException
destroyPubkeyAuthback to summary
private void destroyPubkeyAuth()
destroyUserAuthback to summary
private void destroyUserAuth()
getClientSessionback to summary
public ClientSession getClientSession()

Implements org.apache.sshd.client.session.ClientSessionHolder.getClientSession.

Returns:ClientSession

Doc from org.apache.sshd.client.session.ClientSessionHolder.getClientSession.

The underlying ClientSession used

Annotations
@Override
getCurrentServiceNameback to summary
public String getCurrentServiceName()
getPropertiesback to summary
public Map<String, Object> getProperties()

Implements org.apache.sshd.common.PropertyResolver.getProperties.

Doc from org.apache.sshd.common.PropertyResolver.getProperties.

A map of properties that can be used to configure the SSH server or client. This map will never be changed by either the server or client and is not supposed to be changed at runtime (changes are not bound to have any effect on a running client or server), though it may affect the creation of sessions later as these values are usually not cached

Note

the type of the mapped property should match the expected configuration value type - Long, Integer, Boolean, String, etc.... If it doesn't, the toString() result of the mapped value is used to convert it to the required type. E.g., if the mapped value is the string "1234" and the expected value is a long then it will be parsed into one. Also, if the mapped value is an Integer but a long is expected, then it will be converted into one.

Returns:Map<String, Object>

a valid Map containing configuration values, never null

Note

may be immutable.

Annotations
@Override
getSessionback to summary
public ClientSession getSession()

Implements org.apache.sshd.common.session.SessionHolder.getSession.

Annotations
@Override
preCloseback to summary
protected void preClose()

Overrides org.apache.sshd.common.util.closeable.AbstractCloseable.preClose.

Doc from org.apache.sshd.common.util.closeable.AbstractCloseable.preClose.

preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately. When preClose() is called, isClosing() == true

Annotations
@Override
processback to summary
public void process(int cmd, Buffer buffer) throws Exception

Implements org.apache.sshd.common.Service.process.

Doc from org.apache.sshd.common.Service.process.

Service the request.

Parameters
cmd:int

The incoming command type

buffer:Buffer

The Buffer containing optional command parameters

Annotations
@Override
Exceptions
Exception:
If failed to process the command
processUserAuthback to summary
protected void processUserAuth(int cmd, Buffer buffer, AuthFuture authFuture) throws Exception

Execute one step in user authentication.

Parameters
cmd:int

the command

buffer:Buffer

the input Buffer, with the reading position after the command byte

authFuture:AuthFuture

the AuthFuture

Exceptions
Exception:
If failed to process
sendInitialAuthRequestback to summary
protected IoWriteFuture sendInitialAuthRequest(ClientSession session, String service) throws IOException
startback to summary
public void start()

Implements org.apache.sshd.common.Service.start.

Annotations
@Override
tryNextback to summary
protected void tryNext(int cmd, AuthFuture authFuture) throws Exception
updateCurrentAuthFutureback to summary
protected AuthFuture updateCurrentAuthFuture(ClientSession session, String service) throws IOException