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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate ClientSessionprivate final Stringprivate StringFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Called to release any allocated resourcesfinal StringgetName()voidinit(ClientSession session, String service) booleanTells whether the authentication protocol is cancellable currently.booleanprotected abstract booleanprocessAuthDataRequest(ClientSession session, String service, Buffer buffer) protected abstract booleansendAuthDataRequest(ClientSession session, String service) protected voidsetCancellable(boolean cancellable) Sets whether the authentication protocol is currently cancellable.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, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.client.auth.UserAuth
signalAuthMethodFailure, signalAuthMethodSuccess
-
Field Details
-
name
-
clientSession
-
service
-
cancellable
private boolean cancellable
-
-
Constructor Details
-
AbstractUserAuth
-
-
Method Details
-
getClientSession
- Specified by:
getClientSessionin interfaceClientSessionHolder- Returns:
- The underlying
ClientSessionused
-
getSession
- Specified by:
getSessionin interfaceUserAuthInstance<ClientSession>- Returns:
- The current session for which the authentication is being tracked. Note: may be
nullif the instance has not been initialized yet
-
getName
- Specified by:
getNamein interfaceNamedResource- Returns:
- The resource name
-
getService
-
isCancellable
public boolean isCancellable()Description copied from interface:UserAuthTells whether the authentication protocol is cancellable currently.- Specified by:
isCancellablein interfaceUserAuth- Returns:
trueif the protocol can be canceled at its current state;falseif not.
-
setCancellable
protected void setCancellable(boolean cancellable) Sets whether the authentication protocol is currently cancellable.- Parameters:
cancellable-trueif the protocol may be canceled in its current state;falseif not
-
init
- Specified by:
initin interfaceUserAuth- Parameters:
session- TheClientSessionservice- The requesting service name- Throws:
Exception- If failed to initialize the mechanism
-
process
- Specified by:
processin interfaceUserAuth- Parameters:
buffer- TheBufferto process -nullif not a response buffer, i.e., the underlying authentication mechanism should initiate whatever challenge/response mechanism is required- Returns:
trueif request handled -falseif the next authentication mechanism should be used- Throws:
Exception- If failed to process the request
-
sendAuthDataRequest
protected abstract boolean sendAuthDataRequest(ClientSession session, String service) throws Exception - Throws:
Exception
-
processAuthDataRequest
protected abstract boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception - Throws:
Exception
-
destroy
public void destroy()Description copied from interface:UserAuthCalled to release any allocated resources -
toString
-