Package org.apache.sshd.client.auth
Class AbstractUserAuth
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.auth.AbstractUserAuth
-
- All Implemented Interfaces:
UserAuth
,ClientSessionHolder
,UserAuthInstance<ClientSession>
,NamedResource
- Direct Known Subclasses:
UserAuthHostBased
,UserAuthKeyboardInteractive
,UserAuthPassword
,UserAuthPublicKey
public abstract class AbstractUserAuth extends AbstractLoggingBean implements UserAuth
-
-
Field Summary
Fields Modifier and Type Field Description private ClientSession
clientSession
private java.lang.String
name
private java.lang.String
service
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractUserAuth(java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
destroy()
Called to release any allocated resourcesClientSession
getClientSession()
java.lang.String
getName()
java.lang.String
getService()
ClientSession
getSession()
void
init(ClientSession session, java.lang.String service)
boolean
process(Buffer buffer)
protected abstract boolean
processAuthDataRequest(ClientSession session, java.lang.String service, Buffer buffer)
protected abstract boolean
sendAuthDataRequest(ClientSession session, java.lang.String service)
java.lang.String
toString()
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.client.auth.UserAuth
signalAuthMethodFailure, signalAuthMethodSuccess
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
clientSession
private ClientSession clientSession
-
service
private java.lang.String service
-
-
Method Detail
-
getClientSession
public ClientSession getClientSession()
- Specified by:
getClientSession
in interfaceClientSessionHolder
- Returns:
- The underlying
ClientSession
used
-
getSession
public ClientSession getSession()
- Specified by:
getSession
in interfaceUserAuthInstance<ClientSession>
- Returns:
- The current session for which the authentication is being tracked. Note: may be
null
if the instance has not been initialized yet
-
getName
public final java.lang.String getName()
- Specified by:
getName
in interfaceNamedResource
- Returns:
- The resource name
-
getService
public java.lang.String getService()
-
init
public void init(ClientSession session, java.lang.String service) throws java.lang.Exception
- Specified by:
init
in interfaceUserAuth
- Parameters:
session
- TheClientSession
service
- The requesting service name- Throws:
java.lang.Exception
- If failed to initialize the mechanism
-
process
public boolean process(Buffer buffer) throws java.lang.Exception
- Specified by:
process
in interfaceUserAuth
- Parameters:
buffer
- TheBuffer
to process -null
if not a response buffer, i.e., the underlying authentication mechanism should initiate whatever challenge/response mechanism is required- Returns:
true
if request handled -false
if the next authentication mechanism should be used- Throws:
java.lang.Exception
- If failed to process the request
-
sendAuthDataRequest
protected abstract boolean sendAuthDataRequest(ClientSession session, java.lang.String service) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processAuthDataRequest
protected abstract boolean processAuthDataRequest(ClientSession session, java.lang.String service, Buffer buffer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
destroy
public void destroy()
Description copied from interface:UserAuth
Called to release any allocated resources
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-