Class JGitClientSession
- 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.common.util.closeable.AbstractInnerCloseable
-
- org.apache.sshd.common.kex.AbstractKexFactoryManager
-
- org.apache.sshd.common.session.helpers.SessionHelper
-
- org.apache.sshd.common.session.helpers.AbstractSession
-
- org.apache.sshd.client.session.AbstractClientSession
-
- org.apache.sshd.client.session.ClientSessionImpl
-
- org.eclipse.jgit.internal.transport.sshd.JGitClientSession
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,org.apache.sshd.client.ClientAuthenticationManager
,org.apache.sshd.client.session.ClientProxyConnectorHolder
,org.apache.sshd.client.session.ClientSession
,org.apache.sshd.common.AttributeRepository
,org.apache.sshd.common.AttributeStore
,org.apache.sshd.common.auth.MutableUserHolder
,org.apache.sshd.common.auth.UserAuthFactoriesManager<org.apache.sshd.client.session.ClientSession,org.apache.sshd.client.auth.UserAuth,org.apache.sshd.client.auth.UserAuthFactory>
,org.apache.sshd.common.auth.UsernameHolder
,org.apache.sshd.common.channel.ChannelListenerManager
,org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolver
,org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolverManager
,org.apache.sshd.common.Closeable
,org.apache.sshd.common.FactoryManagerHolder
,org.apache.sshd.common.forward.PortForwardingEventListenerManager
,org.apache.sshd.common.forward.PortForwardingInformationProvider
,org.apache.sshd.common.forward.PortForwardingManager
,org.apache.sshd.common.io.PacketWriter
,org.apache.sshd.common.kex.extension.KexExtensionHandlerManager
,org.apache.sshd.common.kex.KexFactoryManager
,org.apache.sshd.common.keyprovider.KeyIdentityProviderHolder
,org.apache.sshd.common.PropertyResolver
,org.apache.sshd.common.session.ReservedSessionMessagesManager
,org.apache.sshd.common.session.Session
,org.apache.sshd.common.session.SessionContext
,org.apache.sshd.common.session.SessionDisconnectHandlerManager
,org.apache.sshd.common.session.SessionHeartbeatController
,org.apache.sshd.common.session.SessionListenerManager
,org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager
,org.apache.sshd.common.signature.SignatureFactoriesManager
,org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
public class JGitClientSession extends org.apache.sshd.client.session.ClientSessionImpl
AClientSession
that can be associated with theHostConfigEntry
the session was created for. TheJGitSshClient
creates such sessions and sets this association.Also provides for associating a JGit
CredentialsProvider
with a session.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable.State
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
org.apache.sshd.common.AttributeRepository.AttributeKey<T extends Object>
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.client.session.AbstractClientSession
sendImmediateClientIdentification, sendImmediateKexInit
-
Fields inherited from class org.apache.sshd.common.session.helpers.AbstractSession
channelListenerProxy, channelListeners, clientProposal, clientVersion, currentService, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, firstKexPacketFollows, ignorePacketDataLength, ignorePacketsCount, ignorePacketsFrequency, ignorePacketsVariance, inBlocksCount, inBytesCount, inCipher, inCipherSize, inCompression, inMac, inMacResult, inMacSize, inPacketsCount, kex, kexFutureHolder, kexState, lastKeyTimeValue, maxRekeyBlocks, maxRekeyBytes, maxRekeyInterval, maxRekyPackets, negotiationResult, outBlocksCount, outBytesCount, outCipher, outCipherSize, outCompression, outMac, outMacSize, outPacketsCount, pendingPackets, random, requestLock, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, sessionListenerProxy, sessionListeners, tunnelListenerProxy, tunnelListeners, uncompressBuffer, unmodClientProposal, unmodNegotiationResult, unmodServerProposal
-
Fields inherited from class org.apache.sshd.common.session.helpers.SessionHelper
authNanoStart, idleNanoStart, sessionLock
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolver
NONE
-
Fields inherited from interface org.apache.sshd.client.ClientAuthenticationManager
DEFAULT_PASSWORD_PROMPTS, PASSWORD_PROMPTS, PREFERRED_AUTHS
-
Fields inherited from interface org.apache.sshd.client.session.ClientSession
REMOTE_COMMAND_WAIT_EVENTS
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description JGitClientSession(org.apache.sshd.client.ClientFactoryManager manager, org.apache.sshd.common.io.IoSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkKeys()
protected List<String>
doReadIdentification(org.apache.sshd.common.util.buffer.Buffer buffer, boolean server)
Reads the RFC 4253, section 4.2 protocol version identification.CredentialsProvider
getCredentialsProvider()
Retrieves theCredentialsProvider
set for this session.org.apache.sshd.client.config.hosts.HostConfigEntry
getHostConfigEntry()
Retrieves theHostConfigEntry
this session was created for.void
messageReceived(org.apache.sshd.common.util.Readable buffer)
As long as we're still setting up the proxy connection, diverts messages to theStatefulProxyConnector
.protected String
resolveAvailableSignaturesProposal(org.apache.sshd.common.FactoryManager manager)
protected org.apache.sshd.common.io.IoWriteFuture
sendIdentification(String ident)
protected byte[]
sendKexInit()
void
setCredentialsProvider(CredentialsProvider provider)
Sets theCredentialsProvider
for this session.void
setHostConfigEntry(org.apache.sshd.client.config.hosts.HostConfigEntry hostConfig)
Sets theHostConfigEntry
this session was created for.void
setProxyHandler(StatefulProxyConnector handler)
Sets aStatefulProxyConnector
to handle proxy connection protocols.-
Methods inherited from class org.apache.sshd.client.session.ClientSessionImpl
auth, exceptionCaught, getMetadataMap, getServices, getSessionState, handleDisconnect, nextServiceName, preClose, sendInitialServiceRequest, signalAuthFailure, signalSessionEvent, switchToNextService, updateCurrentSessionState, waitFor
-
Methods inherited from class org.apache.sshd.client.session.AbstractClientSession
addPasswordIdentity, addPublicKeyIdentity, createChannel, createChannel, createDirectTcpipChannel, createExecChannel, createShellChannel, createSubsystemChannel, getClientProxyConnector, getConnectAddress, getConnectionContext, getConnectionService, getFactoryManager, getForwardingFilter, getKeyIdentityProvider, getPasswordIdentityProvider, getRegisteredIdentities, getServerKeyVerifier, getUserAuthFactories, getUserAuthService, getUserInteraction, initializeKeyExchangePhase, initializeProxyConnector, readIdentification, receiveKexInit, receiveKexInit, removePasswordIdentity, removePublicKeyIdentity, sendClientIdentification, sendKexInit, setClientProxyConnector, setConnectAddress, setKexSeed, setKeyIdentityProvider, setPasswordIdentityProvider, setServerKeyVerifier, setUserAuthFactories, setUserInteraction, signalExtraServerVersionInfo, startDynamicPortForwarding, startLocalPortForwarding, startRemotePortForwarding, startService, stopDynamicPortForwarding, stopLocalPortForwarding, stopRemotePortForwarding, switchToNoneCipher
-
Methods inherited from class org.apache.sshd.common.session.helpers.AbstractSession
addChannelListener, addPortForwardingEventListener, addSessionListener, appendOutgoingMac, attachSession, checkRekey, comparePreferredKexProposalOption, createBuffer, decode, doHandleMessage, doKexNegotiation, doWritePacket, encode, encryptOutgoingBuffer, getChannelListenerProxy, getCipherInformation, getClientKexData, getClientKexProposals, getClientVersion, getCompressionInformation, getInnerCloseable, getKex, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getPortForwardingEventListenerProxy, getServerKexData, getServerKexProposals, getServerVersion, getService, getSession, getSession, getSessionId, getSessionListenerProxy, handleFirstKexPacketFollows, handleKexExtension, handleKexInit, handleKexMessage, handleMessage, handleNewCompression, handleNewKeys, handleServiceAccept, handleServiceAccept, handleServiceRequest, handleServiceRequest, isRekeyBlocksCountExceeded, isRekeyDataSizeExceeded, isRekeyPacketCountsExceeded, isRekeyRequired, isRekeyTimeIntervalExceeded, negotiate, notImplemented, prepareBuffer, receiveKexInit, receiveNewKeys, reExchangeKeys, refreshConfiguration, removeChannelListener, removePortForwardingEventListener, removeSessionListener, request, requestFailure, requestNewKeysExchange, requestSuccess, resolveAvailableSignaturesProposal, resolveIgnoreBufferDataLength, resolveOutputPacket, resolveSessionKexProposal, sendNewKeys, sendPendingPackets, setClientKexData, setNegotiationResult, setServerKexData, validateIncomingMac, validateKexState, validateTargetBuffer, writePacket
-
Methods inherited from class org.apache.sshd.common.session.helpers.SessionHelper
attributeKeys, calculateNextIgnorePacketCount, checkAuthenticationTimeout, checkForTimeouts, checkIdleTimeout, clearAttributes, computeAttributeIfAbsent, createProposal, disconnect, getAttribute, getAttributesCount, getAuthTimeout, getAuthTimeoutStart, getBoundLocalPortForward, getBoundRemotePortForward, getChannelStreamPacketWriterResolver, getIdleTimeout, getIdleTimeoutStart, getIoSession, getLocalForwardsBindings, getParentPropertyResolver, getProperties, getRemoteForwardsBindings, getReservedSessionMessagesHandler, getSessionDisconnectHandler, getStartedLocalPortForwards, getStartedRemotePortForwards, getTimeoutStatus, getUnknownChannelReferenceHandler, getUsername, handleDebug, handleDisconnect, handleIgnore, handleUnimplemented, invokeSessionSignaller, isAuthenticated, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort, isServerSession, mergeProposals, removeAttribute, resetAuthTimeout, resetIdleTimeout, resizeKey, resolveChannelStreamPacketWriterResolver, resolveIdentificationString, resolvePeerAddress, resolveReservedSessionMessagesHandler, resolveUnknownChannelReferenceHandler, sendDebugMessage, sendIgnoreMessage, sendNotImplemented, setAttribute, setAuthenticated, setChannelStreamPacketWriterResolver, setReservedSessionMessagesHandler, setSessionDisconnectHandler, setUnknownChannelReferenceHandler, setUsername, signalDisconnect, signalDisconnect, signalExceptionCaught, signalExceptionCaught, signalNegotiationEnd, signalNegotiationEnd, signalNegotiationStart, signalNegotiationStart, signalPeerIdentificationReceived, signalPeerIdentificationReceived, signalSessionClosed, signalSessionClosed, signalSessionCreated, signalSessionCreated, signalSessionEstablished, signalSessionEstablished, signalSessionEvent, toString, writePacket
-
Methods inherited from class org.apache.sshd.common.kex.AbstractKexFactoryManager
getCipherFactories, getCompressionFactories, getDelegate, getKexExtensionHandler, getKeyExchangeFactories, getMacFactories, getSignatureFactories, resolveEffectiveFactories, resolveEffectiveProvider, setCipherFactories, setCompressionFactories, setKexExtensionHandler, setKeyExchangeFactories, setMacFactories, setSignatureFactories
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, 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, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount
-
Methods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListener
-
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolverManager
getChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolver
-
Methods inherited from interface org.apache.sshd.client.ClientAuthenticationManager
setUserAuthFactoriesNames
-
Methods inherited from interface org.apache.sshd.client.session.ClientSession
createDynamicPortForwardingTracker, createExecChannel, createLocalPortForwardingTracker, createRemotePortForwardingTracker, createShellChannel, executeRemoteCommand, executeRemoteCommand, executeRemoteCommand
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandlerManager
getKexExtensionHandler, setKexExtensionHandler
-
Methods inherited from interface org.apache.sshd.common.kex.KexFactoryManager
getCipherFactories, getCipherFactoriesNameList, getCipherFactoriesNames, getCompressionFactories, getCompressionFactoriesNameList, getCompressionFactoriesNames, getKeyExchangeFactories, getMacFactories, getMacFactoriesNameList, getMacFactoriesNames, setCipherFactories, setCipherFactoriesNameList, setCipherFactoriesNames, setCipherFactoriesNames, setCompressionFactories, setCompressionFactoriesNameList, setCompressionFactoriesNames, setCompressionFactoriesNames, setKeyExchangeFactories, setMacFactories, setMacFactoriesNameList, setMacFactoriesNames, setMacFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.forward.PortForwardingEventListenerManager
addPortForwardingEventListener, getPortForwardingEventListenerProxy, removePortForwardingEventListener
-
Methods inherited from interface org.apache.sshd.common.forward.PortForwardingInformationProvider
getBoundLocalPortForward, getBoundRemotePortForward, getLocalForwardsBindings, getRemoteForwardsBindings, getStartedLocalPortForwards, getStartedRemotePortForwards, isLocalPortForwardingStartedForPort, isRemotePortForwardingStartedForPort
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty
-
Methods inherited from interface org.apache.sshd.common.session.ReservedSessionMessagesManager
getReservedSessionMessagesHandler, setReservedSessionMessagesHandler
-
Methods inherited from interface org.apache.sshd.common.session.Session
createBuffer, createBuffer, disconnect, getAuthTimeout, getAuthTimeoutStart, getIdleTimeout, getIdleTimeoutStart, getIoSession, getKex, getLocalAddress, getRemoteAddress, getService, getTimeoutStatus, prepareBuffer, reExchangeKeys, request, resetAuthTimeout, resetIdleTimeout, resolveAttribute, sendDebugMessage, sendIgnoreMessage, setAuthenticated, writePacket
-
Methods inherited from interface org.apache.sshd.common.session.SessionContext
getCipherInformation, getClientKexProposals, getClientVersion, getCompressionInformation, getKexNegotiationResult, getKexState, getMacInformation, getNegotiatedKexParameter, getServerKexProposals, getServerVersion, getSessionId, isAuthenticated, isServerSession
-
Methods inherited from interface org.apache.sshd.common.session.SessionDisconnectHandlerManager
getSessionDisconnectHandler, setSessionDisconnectHandler
-
Methods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat
-
Methods inherited from interface org.apache.sshd.common.session.SessionListenerManager
addSessionListener, getSessionListenerProxy, removeSessionListener
-
Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager
getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames, setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
-
Methods inherited from interface org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager
getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandler
-
-
-
-
Method Detail
-
getHostConfigEntry
public org.apache.sshd.client.config.hosts.HostConfigEntry getHostConfigEntry()
Retrieves theHostConfigEntry
this session was created for.- Returns:
- the
HostConfigEntry
, ornull
if none set
-
setHostConfigEntry
public void setHostConfigEntry(org.apache.sshd.client.config.hosts.HostConfigEntry hostConfig)
Sets theHostConfigEntry
this session was created for.- Parameters:
hostConfig
- theHostConfigEntry
-
setCredentialsProvider
public void setCredentialsProvider(CredentialsProvider provider)
Sets theCredentialsProvider
for this session.- Parameters:
provider
- to set
-
getCredentialsProvider
public CredentialsProvider getCredentialsProvider()
Retrieves theCredentialsProvider
set for this session.- Returns:
- the provider, or
null
if none is set.
-
setProxyHandler
public void setProxyHandler(StatefulProxyConnector handler)
Sets aStatefulProxyConnector
to handle proxy connection protocols.- Parameters:
handler
- to set
-
sendIdentification
protected org.apache.sshd.common.io.IoWriteFuture sendIdentification(String ident) throws IOException
- Overrides:
sendIdentification
in classorg.apache.sshd.common.session.helpers.SessionHelper
- Throws:
IOException
-
sendKexInit
protected byte[] sendKexInit() throws IOException, GeneralSecurityException
- Overrides:
sendKexInit
in classorg.apache.sshd.common.session.helpers.AbstractSession
- Throws:
IOException
GeneralSecurityException
-
messageReceived
public void messageReceived(org.apache.sshd.common.util.Readable buffer) throws Exception
As long as we're still setting up the proxy connection, diverts messages to theStatefulProxyConnector
.- Overrides:
messageReceived
in classorg.apache.sshd.common.session.helpers.AbstractSession
- Throws:
Exception
-
checkKeys
protected void checkKeys() throws org.apache.sshd.common.SshException
- Overrides:
checkKeys
in classorg.apache.sshd.client.session.AbstractClientSession
- Throws:
org.apache.sshd.common.SshException
-
resolveAvailableSignaturesProposal
protected String resolveAvailableSignaturesProposal(org.apache.sshd.common.FactoryManager manager)
- Overrides:
resolveAvailableSignaturesProposal
in classorg.apache.sshd.client.session.AbstractClientSession
-
doReadIdentification
protected List<String> doReadIdentification(org.apache.sshd.common.util.buffer.Buffer buffer, boolean server) throws StreamCorruptedException
Reads the RFC 4253, section 4.2 protocol version identification. The Apache MINA sshd default implementation checks for NUL bytes also in any preceding lines, whereas RFC 4253 requires such a check only for the actual identification string starting with "SSH-". Likewise, the 255 character limit exists only for the identification string, not for the preceding lines. CR-LF handling is also relaxed.- Overrides:
doReadIdentification
in classorg.apache.sshd.common.session.helpers.SessionHelper
- Parameters:
buffer
- to read fromserver
- whether we're an SSH server (should always befalse
)- Returns:
- the lines read, with the server identification line last, or
null
if no identification line was found and more bytes are needed - Throws:
StreamCorruptedException
- if the identification is malformed- See Also:
- RFC 4253, section 4.2
-
-