Class UserAuthHostBased
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.client.auth.AbstractUserAuth
-
- org.apache.sshd.client.auth.hostbased.UserAuthHostBased
-
- All Implemented Interfaces:
UserAuth
,ClientSessionHolder
,UserAuthInstance<ClientSession>
,NamedResource
,SignatureFactoriesHolder
,SignatureFactoriesManager
public class UserAuthHostBased extends AbstractUserAuth implements SignatureFactoriesManager
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description protected HostKeyIdentityProvider
clientHostKeys
protected Map.Entry<KeyPair,? extends Collection<X509Certificate>>
keyInfo
protected Iterator<? extends Map.Entry<KeyPair,? extends Collection<X509Certificate>>>
keys
static String
NAME
-
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 Constructor Description UserAuthHostBased(HostKeyIdentityProvider clientHostKeys)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
appendSignature(ClientSession session, String service, String keyType, PublicKey key, byte[] keyBytes, String clientHostname, String clientUsername, Signature verifier, Buffer buffer)
String
getClientHostname()
String
getClientUsername()
List<NamedFactory<Signature>>
getSignatureFactories()
void
init(ClientSession session, String service)
protected boolean
processAuthDataRequest(ClientSession session, String service, Buffer buffer)
protected String
resolveClientHostname(ClientSession session)
protected String
resolveClientUsername(ClientSession session)
protected boolean
sendAuthDataRequest(ClientSession session, String service)
void
setClientHostname(String clientHostname)
void
setClientUsername(String clientUsername)
void
setSignatureFactories(List<NamedFactory<Signature>> factories)
void
signalAuthMethodFailure(ClientSession session, String service, boolean partial, List<String> serverMethods, Buffer buffer)
Signals reception ofSSH_MSG_USERAUTH_FAILURE
messagevoid
signalAuthMethodSuccess(ClientSession session, String service, Buffer buffer)
Signal reception ofSSH_MSG_USERAUTH_SUCCESS
message-
Methods inherited from class org.apache.sshd.client.auth.AbstractUserAuth
destroy, getClientSession, getName, getService, getSession, process, 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.common.signature.SignatureFactoriesHolder
getSignatureFactoriesNameList, getSignatureFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
keys
protected Iterator<? extends Map.Entry<KeyPair,? extends Collection<X509Certificate>>> keys
-
keyInfo
protected Map.Entry<KeyPair,? extends Collection<X509Certificate>> keyInfo
-
clientHostKeys
protected final HostKeyIdentityProvider clientHostKeys
-
-
Constructor Detail
-
UserAuthHostBased
public UserAuthHostBased(HostKeyIdentityProvider clientHostKeys)
-
-
Method Detail
-
init
public void init(ClientSession session, String service) throws Exception
- Specified by:
init
in interfaceUserAuth
- Overrides:
init
in classAbstractUserAuth
- Parameters:
session
- TheClientSession
service
- The requesting service name- Throws:
Exception
- If failed to initialize the mechanism
-
getSignatureFactories
public List<NamedFactory<Signature>> getSignatureFactories()
- Specified by:
getSignatureFactories
in interfaceSignatureFactoriesHolder
-
setSignatureFactories
public void setSignatureFactories(List<NamedFactory<Signature>> factories)
- Specified by:
setSignatureFactories
in interfaceSignatureFactoriesManager
-
getClientUsername
public String getClientUsername()
-
setClientUsername
public void setClientUsername(String clientUsername)
-
getClientHostname
public String getClientHostname()
-
setClientHostname
public void setClientHostname(String clientHostname)
-
sendAuthDataRequest
protected boolean sendAuthDataRequest(ClientSession session, String service) throws Exception
- Specified by:
sendAuthDataRequest
in classAbstractUserAuth
- Throws:
Exception
-
appendSignature
protected byte[] appendSignature(ClientSession session, String service, String keyType, PublicKey key, byte[] keyBytes, String clientHostname, String clientUsername, Signature verifier, Buffer buffer) throws Exception
- Throws:
Exception
-
processAuthDataRequest
protected boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception
- Specified by:
processAuthDataRequest
in classAbstractUserAuth
- Throws:
Exception
-
signalAuthMethodSuccess
public void signalAuthMethodSuccess(ClientSession session, String service, Buffer buffer) throws Exception
Description copied from interface:UserAuth
Signal reception ofSSH_MSG_USERAUTH_SUCCESS
message- Specified by:
signalAuthMethodSuccess
in interfaceUserAuth
- Parameters:
session
- TheClientSession
service
- The requesting service namebuffer
- TheBuffer
containing the success message (after having consumed the relevant data from it)- Throws:
Exception
- If failed to handle the callback - Note: may cause session close
-
signalAuthMethodFailure
public void signalAuthMethodFailure(ClientSession session, String service, boolean partial, List<String> serverMethods, Buffer buffer) throws Exception
Description copied from interface:UserAuth
Signals reception ofSSH_MSG_USERAUTH_FAILURE
message- Specified by:
signalAuthMethodFailure
in interfaceUserAuth
- Parameters:
session
- TheClientSession
service
- The requesting service namepartial
-true
if some partial authentication success so farserverMethods
- TheList
of authentication methods that can continuebuffer
- TheBuffer
containing the failure message (after having consumed the relevant data from it)- Throws:
Exception
- If failed to handle the callback - Note: may cause session close
-
resolveClientUsername
protected String resolveClientUsername(ClientSession session)
-
resolveClientHostname
protected String resolveClientHostname(ClientSession session)
-
-