Class JGitSshClient

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Channel, org.apache.sshd.client.ClientAuthenticationManager, org.apache.sshd.client.ClientFactoryManager, org.apache.sshd.client.config.keys.ClientIdentityLoaderHolder, org.apache.sshd.client.config.keys.ClientIdentityLoaderManager, org.apache.sshd.client.session.ClientProxyConnectorHolder, org.apache.sshd.client.session.ClientSessionCreator, org.apache.sshd.common.AttributeRepository, org.apache.sshd.common.AttributeStore, 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.channel.ChannelListenerManager, org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolver, org.apache.sshd.common.channel.throttle.ChannelStreamWriterResolverManager, org.apache.sshd.common.Closeable, org.apache.sshd.common.config.keys.FilePasswordProviderHolder, org.apache.sshd.common.config.keys.FilePasswordProviderManager, org.apache.sshd.common.FactoryManager, org.apache.sshd.common.forward.PortForwardingEventListenerManager, org.apache.sshd.common.io.IoServiceEventListenerManager, 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.SessionDisconnectHandlerManager, org.apache.sshd.common.session.SessionHeartbeatController, org.apache.sshd.common.session.SessionListenerManager, org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager, org.apache.sshd.common.signature.SignatureFactoriesHolder, org.apache.sshd.common.signature.SignatureFactoriesManager

    public class JGitSshClient
    extends org.apache.sshd.client.SshClient
    Customized SshClient for JGit. It creates specialized JGitClientSessions that know about the HostConfigEntry they were created for, and it loads all KeyPair identities lazily.
    • 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>
      • Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController

        org.apache.sshd.common.session.SessionHeartbeatController.HeartbeatType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.apache.sshd.common.AttributeRepository.AttributeKey<Path> HOME_DIRECTORY
      An attribute key for the home directory.
      static org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.common.util.net.SshdSocketAddress> LOCAL_FORWARD_ADDRESS
      An attribute key for storing an alternate local address to connect to if a local forward from a ProxyJump ssh config is present.
      static org.apache.sshd.common.AttributeRepository.AttributeKey<String> PREFERRED_AUTHENTICATIONS
      An attribute key for the comma-separated list of default preferred authentication mechanisms.
      • Fields inherited from class org.apache.sshd.client.SshClient

        connector, DEFAULT_SERVICE_FACTORIES, DEFAULT_SSH_CLIENT_FACTORY, DEFAULT_USER_AUTH_FACTORIES, sessionFactory, userAuthFactories
      • Fields inherited from class org.apache.sshd.common.helpers.AbstractFactoryManager

        agentFactory, channelFactories, channelListenerProxy, channelListeners, executor, fileSystemFactory, forwarderFactory, forwardingFilter, globalRequestHandlers, ioServiceFactory, ioServiceFactoryFactory, randomFactory, serviceFactories, sessionListenerProxy, sessionListeners, sessionTimeoutListener, shutdownExecutor, timeoutListenerFuture, tunnelListenerProxy, tunnelListeners
      • 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.channel.throttle.ChannelStreamWriterResolver

        NONE
      • Fields inherited from interface org.apache.sshd.client.session.ClientSessionCreator

        TARGET_SERVER
      • Fields inherited from interface org.apache.sshd.common.FactoryManager

        DEFAULT_VERSION
      • Fields inherited from interface org.apache.sshd.common.PropertyResolver

        EMPTY
    • Constructor Summary

      Constructors 
      Constructor Description
      JGitSshClient()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkConfig()  
      org.apache.sshd.client.future.ConnectFuture connect​(org.apache.sshd.client.config.hosts.HostConfigEntry hostConfig, org.apache.sshd.common.AttributeRepository context, SocketAddress localAddress)  
      protected org.apache.sshd.client.session.SessionFactory createSessionFactory()  
      org.apache.sshd.agent.SshAgentFactory getAgentFactory()  
      CredentialsProvider getCredentialsProvider()
      Retrieves the CredentialsProvider set for this client.
      protected ProxyDataFactory getProxyDatabase()
      Retrieves the ProxyDataFactory.
      void setCredentialsProvider​(CredentialsProvider provider)
      Sets the CredentialsProvider for this client.
      void setKeyCache​(KeyCache cache)
      Set a cache for loaded keys.
      void setProxyDatabase​(ProxyDataFactory factory)
      Sets a ProxyDataFactory for connecting through proxies.
      • Methods inherited from class org.apache.sshd.client.SshClient

        addPasswordIdentity, addPublicKeyIdentity, connect, connect, connect, createConnectCompletionListener, createConnector, doConnect, doConnect, getClientIdentityLoader, getClientProxyConnector, getFilePasswordProvider, getHostBasedAuthenticationReporter, getHostConfigEntryResolver, getInnerCloseable, getKeyIdentityProvider, getPasswordAuthenticationReporter, getPasswordIdentityProvider, getPublicKeyAuthenticationReporter, getRegisteredIdentities, getServerKeyVerifier, getSessionFactory, getUserAuthFactories, getUserInteraction, isStarted, onConnectOperationComplete, open, parseProxyJumps, preloadClientIdentities, removePasswordIdentity, removePublicKeyIdentity, resolveHost, setClientIdentityLoader, setClientProxyConnector, setFilePasswordProvider, setHostBasedAuthenticationReporter, setHostConfigEntryResolver, setKeyIdentityProvider, setKeyPairProvider, setKeyPairProvider, setPasswordAuthenticationReporter, setPasswordIdentityProvider, setPublicKeyAuthenticationReporter, setServerKeyVerifier, setSessionFactory, setUpDefaultClient, setupDefaultSessionIdentities, setUpDefaultSimpleClient, setUserAuthFactories, setUserInteraction, start, stop, toString, wrapAsSimpleClient
      • Methods inherited from class org.apache.sshd.common.helpers.AbstractFactoryManager

        addChannelListener, addPortForwardingEventListener, addSessionListener, attributeKeys, clearAttributes, computeAttributeIfAbsent, createSessionTimeoutListener, getAttribute, getAttributesCount, getChannelFactories, getChannelListenerProxy, getChannelStreamWriterResolver, getFileSystemFactory, getForwarderFactory, getForwardingFilter, getGlobalRequestHandlers, getIoServiceEventListener, getIoServiceFactory, getIoServiceFactoryFactory, getNioWorkers, getParentPropertyResolver, getPortForwardingEventListenerProxy, getProperties, getRandomFactory, getReservedSessionMessagesHandler, getScheduledExecutorService, getServiceFactories, getSessionDisconnectHandler, getSessionListenerProxy, getUnknownChannelReferenceHandler, getVersion, removeAttribute, removeChannelListener, removePortForwardingEventListener, removeSessionListener, removeSessionTimeout, resolveUnknownChannelReferenceHandler, setAgentFactory, setAttribute, setChannelFactories, setChannelStreamWriterResolver, setFileSystemFactory, setForwarderFactory, setForwardingFilter, setGlobalRequestHandlers, setIoServiceEventListener, setIoServiceFactoryFactory, setNioWorkers, setParentPropertyResolver, setRandomFactory, setReservedSessionMessagesHandler, setScheduledExecutorService, setScheduledExecutorService, setServiceFactories, setSessionDisconnectHandler, setUnknownChannelReferenceHandler, setupSessionTimeout, stopSessionTimeoutListener
      • 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, preClose, removeCloseFutureListener
      • 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 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.ChannelStreamWriterResolverManager

        getChannelStreamWriterResolver, resolveChannelStreamWriter, resolveChannelStreamWriterResolver, setChannelStreamWriterResolver
      • Methods inherited from interface org.apache.sshd.client.ClientAuthenticationManager

        setUserAuthFactoriesNames
      • Methods inherited from interface org.apache.sshd.client.session.ClientSessionCreator

        connect, connect, connect, connect, connect, connect, connect, connect, connect
      • Methods inherited from interface org.apache.sshd.common.Closeable

        addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
      • Methods inherited from interface org.apache.sshd.common.FactoryManager

        getAgentForwardingFilter, getChannelFactories, getFileSystemFactory, getForwarderFactory, getForwardingFilter, getGlobalRequestHandlers, getIoServiceFactory, getRandomFactory, getScheduledExecutorService, getServiceFactories, getTcpForwardingFilter, getVersion, getX11ForwardingFilter, resolveAttribute
      • Methods inherited from interface org.apache.sshd.common.io.IoServiceEventListenerManager

        getIoServiceEventListener, setIoServiceEventListener
      • 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.PropertyResolver

        getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmpty
      • Methods inherited from interface org.apache.sshd.common.session.ReservedSessionMessagesManager

        getReservedSessionMessagesHandler, setReservedSessionMessagesHandler
      • 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, setSessionHeartbeat
      • Methods inherited from interface org.apache.sshd.common.session.SessionListenerManager

        addSessionListener, getSessionListenerProxy, removeSessionListener
      • Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesHolder

        getSignatureFactories, getSignatureFactoriesNameList, getSignatureFactoriesNames
      • Methods inherited from interface org.apache.sshd.common.signature.SignatureFactoriesManager

        setSignatureFactories, setSignatureFactoriesNameList, setSignatureFactoriesNames, setSignatureFactoriesNames
      • Methods inherited from interface org.apache.sshd.common.session.UnknownChannelReferenceHandlerManager

        getUnknownChannelReferenceHandler, resolveUnknownChannelReferenceHandler, setUnknownChannelReferenceHandler
      • Methods inherited from interface org.apache.sshd.common.auth.UserAuthFactoriesManager

        getUserAuthFactoriesNameList, getUserAuthFactoriesNames, setUserAuthFactoriesNameList, setUserAuthFactoriesNames
    • Field Detail

      • PREFERRED_AUTHENTICATIONS

        public static final org.apache.sshd.common.AttributeRepository.AttributeKey<String> PREFERRED_AUTHENTICATIONS
        An attribute key for the comma-separated list of default preferred authentication mechanisms.
      • HOME_DIRECTORY

        public static final org.apache.sshd.common.AttributeRepository.AttributeKey<Path> HOME_DIRECTORY
        An attribute key for the home directory.
      • LOCAL_FORWARD_ADDRESS

        public static final org.apache.sshd.common.AttributeRepository.AttributeKey<org.apache.sshd.common.util.net.SshdSocketAddress> LOCAL_FORWARD_ADDRESS
        An attribute key for storing an alternate local address to connect to if a local forward from a ProxyJump ssh config is present. If set, connect(HostConfigEntry, AttributeRepository, SocketAddress) will not connect to the address obtained from the HostConfigEntry but to the address stored in this key (which is assumed to forward the HostConfigEntry address).
    • Constructor Detail

      • JGitSshClient

        public JGitSshClient()
    • Method Detail

      • createSessionFactory

        protected org.apache.sshd.client.session.SessionFactory createSessionFactory()
        Overrides:
        createSessionFactory in class org.apache.sshd.client.SshClient
      • connect

        public org.apache.sshd.client.future.ConnectFuture connect​(org.apache.sshd.client.config.hosts.HostConfigEntry hostConfig,
                                                                   org.apache.sshd.common.AttributeRepository context,
                                                                   SocketAddress localAddress)
                                                            throws IOException
        Specified by:
        connect in interface org.apache.sshd.client.session.ClientSessionCreator
        Overrides:
        connect in class org.apache.sshd.client.SshClient
        Throws:
        IOException
      • setKeyCache

        public void setKeyCache​(KeyCache cache)
        Set a cache for loaded keys. Newly discovered keys will be added when IdentityFile host entries from the ssh config file are used during session authentication.
        Parameters:
        cache - to use
      • setProxyDatabase

        public void setProxyDatabase​(ProxyDataFactory factory)
        Sets a ProxyDataFactory for connecting through proxies.
        Parameters:
        factory - to use, or null if proxying is not desired or supported
      • getAgentFactory

        public org.apache.sshd.agent.SshAgentFactory getAgentFactory()
        Specified by:
        getAgentFactory in interface org.apache.sshd.common.FactoryManager
        Overrides:
        getAgentFactory in class org.apache.sshd.common.helpers.AbstractFactoryManager
      • checkConfig

        protected void checkConfig()
        Overrides:
        checkConfig in class org.apache.sshd.client.SshClient