Class ClientUserAuthService
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.closeable.IoBaseCloseable
-
- org.apache.sshd.common.util.closeable.AbstractCloseable
-
- org.apache.sshd.client.session.ClientUserAuthService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,ClientSessionHolder
,Closeable
,PropertyResolver
,Service
,SessionContextHolder
,SessionHolder<Session>
public class ClientUserAuthService extends AbstractCloseable implements Service, ClientSessionHolder
Client sidessh-auth
service.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<UserAuthFactory>
authFactories
private java.util.concurrent.atomic.AtomicReference<AuthFuture>
authFutureHolder
The AuthFuture that is being used by the current auth request.private java.util.List<java.lang.String>
clientMethods
private ClientSessionImpl
clientSession
private int
currentMethod
private java.util.Map<java.lang.String,java.lang.Object>
properties
private java.util.List<java.lang.String>
serverMethods
private java.lang.String
service
private UserAuth
userAuth
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ClientUserAuthService(Session s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthFuture
auth(java.lang.String service)
ClientSession
getClientSession()
java.util.Map<java.lang.String,java.lang.Object>
getProperties()
A map of properties that can be used to configure the SSH server or client.ClientSession
getSession()
protected void
preClose()
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.void
process(int cmd, Buffer buffer)
Service the request.protected void
processUserAuth(Buffer buffer)
Execute one step in user authentication.void
start()
protected void
tryNext(int cmd)
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseGracefully, doCloseImmediately, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty
-
Methods inherited from interface org.apache.sshd.common.Service
getParentPropertyResolver
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
authFutureHolder
private final java.util.concurrent.atomic.AtomicReference<AuthFuture> authFutureHolder
The AuthFuture that is being used by the current auth request. This encodes the state. isSuccess -> authenticated, else if isDone -> server waiting for user auth, else authenticating.
-
properties
private final java.util.Map<java.lang.String,java.lang.Object> properties
-
clientSession
private final ClientSessionImpl clientSession
-
clientMethods
private final java.util.List<java.lang.String> clientMethods
-
authFactories
private final java.util.List<UserAuthFactory> authFactories
-
service
private java.lang.String service
-
serverMethods
private java.util.List<java.lang.String> serverMethods
-
userAuth
private UserAuth userAuth
-
currentMethod
private int currentMethod
-
-
Constructor Detail
-
ClientUserAuthService
public ClientUserAuthService(Session s)
-
-
Method Detail
-
getSession
public ClientSession getSession()
- Specified by:
getSession
in interfaceSessionHolder<Session>
-
getClientSession
public ClientSession getClientSession()
- Specified by:
getClientSession
in interfaceClientSessionHolder
- Returns:
- The underlying
ClientSession
used
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Description copied from interface:PropertyResolver
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, thetoString()
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 along
then it will be parsed into one. Also, if the mapped value is anInteger
but along
is expected, then it will be converted into one.- Specified by:
getProperties
in interfacePropertyResolver
- Returns:
- a valid
Map
containing configuration values, nevernull
. Note: may be immutable.
-
auth
public AuthFuture auth(java.lang.String service) throws java.io.IOException
- Throws:
java.io.IOException
-
process
public void process(int cmd, Buffer buffer) throws java.lang.Exception
Description copied from interface:Service
Service the request.
-
processUserAuth
protected void processUserAuth(Buffer buffer) throws java.lang.Exception
Execute one step in user authentication.- Parameters:
buffer
- The inputBuffer
- Throws:
java.lang.Exception
- If failed to process
-
tryNext
protected void tryNext(int cmd) throws java.lang.Exception
- Throws:
java.lang.Exception
-
preClose
protected void preClose()
Description copied from class:AbstractCloseable
preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately. When preClose() is called, isClosing() == true- Overrides:
preClose
in classAbstractCloseable
-
-