public abstract class JschConfigSessionFactory extends SshSessionFactory
$HOME/.ssh
.
This is the default implementation used by JGit and provides most of the compatibility necessary to match OpenSSH, a popular implementation of SSH used by C Git.
The factory does not provide UI behavior. Override the method
configure(org.eclipse.jgit.transport.OpenSshConfig.Host, Session)
to
supply appropriate UserInfo
to the session.
Constructor and Description |
---|
JschConfigSessionFactory() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
configure(OpenSshConfig.Host hc,
com.jcraft.jsch.Session session)
Provide additional configuration for the session based on the host
information.
|
protected void |
configureJSch(com.jcraft.jsch.JSch jsch)
Provide additional configuration for the JSch instance.
|
protected com.jcraft.jsch.JSch |
createDefaultJSch(FS fs)
Create default instance of jsch
|
protected com.jcraft.jsch.Session |
createSession(OpenSshConfig.Host hc,
String user,
String host,
int port,
FS fs)
Create a new remote session for the requested address.
|
protected com.jcraft.jsch.JSch |
getJSch(OpenSshConfig.Host hc,
FS fs)
Obtain the JSch used to create new sessions.
|
RemoteSession |
getSession(URIish uri,
CredentialsProvider credentialsProvider,
FS fs,
int tms)
Open (or reuse) a session to a host.
|
getInstance, releaseSession, setInstance
public RemoteSession getSession(URIish uri, CredentialsProvider credentialsProvider, FS fs, int tms) throws TransportException
A reasonable UserInfo that can interact with the end-user (if necessary) is installed on the returned session by this method.
The caller must connect the session by invoking connect()
if it has not already been connected.
getSession
in class SshSessionFactory
uri
- URI information about the remote hostcredentialsProvider
- provider to support authentication, may be null.fs
- the file system abstraction which will be necessary to
perform certain file system operations.tms
- Timeout value, in milliseconds.TransportException
- the session could not be created.protected com.jcraft.jsch.Session createSession(OpenSshConfig.Host hc, String user, String host, int port, FS fs) throws com.jcraft.jsch.JSchException
hc
- host configurationuser
- login to authenticate as.host
- server name to connect to.port
- port number of the SSH daemon (typically 22).fs
- the file system abstraction which will be necessary to
perform certain file system operations.com.jcraft.jsch.JSchException
- the session could not be created.protected void configureJSch(com.jcraft.jsch.JSch jsch)
IdentityRepository
.jsch
- jsch instanceprotected abstract void configure(OpenSshConfig.Host hc, com.jcraft.jsch.Session session)
UserInfo
.hc
- host configurationsession
- session to configureprotected com.jcraft.jsch.JSch getJSch(OpenSshConfig.Host hc, FS fs) throws com.jcraft.jsch.JSchException
hc
- host configurationfs
- the file system abstraction which will be necessary to
perform certain file system operations.com.jcraft.jsch.JSchException
- the user configuration could not be created.protected com.jcraft.jsch.JSch createDefaultJSch(FS fs) throws com.jcraft.jsch.JSchException
fs
- the file system abstraction which will be necessary to perform
certain file system operations.com.jcraft.jsch.JSchException
- known host keys cannot be loaded.Copyright © 2018 Eclipse JGit Project. All rights reserved.