Connectors. This is a service provider
interface; implementations are discovered via the
java.util.ServiceLoader , or can be set explicitly on a
org.eclipse.jgit.transport.sshd.SshdSessionFactory .
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ConnectorFactory.
|
| Modifier and Type | Method and Description |
|---|---|
| public Connector | Returns: a newConnectoridentifies the wanted agent connection; if identityAgent, File null, the
factory is free to provide a Connector to a default
agent. The value will typically come from the
IdentityAgent setting in ~/.ssh/config.the current local user's home directory as configured in the
homeDir)org.Creates a new |
| public static ConnectorFactory | Returns: the current default factory; may benull if none is set
and the java. cannot find any suitable
implementationRetrieves the currently set default |
| public ConnectorFactory. | Returns: aConnectorDescriptor for the default connectorTells what kind of |
| public String | |
| public Collection | Returns: an immutable collection ofConnectorDescriptors,
including getDefaultConnector() and not including a
descriptor for internal name "none"Tells which kinds of SSH agents this |
| public boolean | Returns: true if the factory can be used, false otherwiseTells whether this |
| public static void | setDefault(ConnectorFactory
ConnectorFactory to set, or null to revert to
the default behavior of using the
java..Sets a default |
| create | back to summary |
|---|---|
| public Connector create(String identityAgent, File homeDir) throws IOException Creates a new
| |
| getDefault | back to summary |
|---|---|
| public static ConnectorFactory getDefault() Retrieves the currently set default
| |
| getDefaultConnector | back to summary |
|---|---|
| public ConnectorFactory. Tells what kind of
| |
| getName | back to summary |
|---|---|
| public String getName() Retrieves a name for this factory.
| |
| getSupportedConnectors | back to summary |
|---|---|
| public Collection Tells which kinds of SSH agents this An implementation of this method should document the possible values it returns.
| |
| isSupported | back to summary |
|---|---|
| public boolean isSupported() Tells whether this
| |
| setDefault | back to summary |
|---|---|
| public static void setDefault(ConnectorFactory factory) Sets a default
If no default factory is set programmatically, an implementation is
discovered via the
| |
ConnectorDescriptors describe available Connectors a
ConnectorFactory may provide.
A ConnectorFactory may support connecting to different SSH
agents. Agents are identified by name; a user can choose a specific agent
for instance via the IdentityAgent setting in
~/.ssh/config.
OpenSSH knows two built-in names: "none" for not using any agent, and
"SSH_AUTH_SOCK" for using an agent that communicates over a Unix domain
socket given by the value of environment variable SSH_AUTH_SOCK.
Other agents can be specified in OpenSSH by specifying the socket file
directly. (The "standard" OpenBSD OpenSSH knows only this communication
mechanism.) "SSH_AUTH_SOCK" is also the default in OpenBSD OpenSSH if
nothing is configured.
A particular ConnectorFactory may support more communication
mechanisms or different agents. For instance, a factory on Windows might
support Pageant, Win32-OpenSSH, or even git bash ssh-agent, and might
accept internal names like "pageant", "openssh", "SSH_AUTH_SOCK" in
ConnectorFactory#create(String, File) to choose among them.
ConnectorDescriptor interface and the
ConnectorFactory#getSupportedConnectors() and
ConnectorFactory#getDefaultConnector() methods provide a way for
code using a ConnectorFactory to learn what the factory supports
and thus implement some way by which a user can influence the default
behavior if IdentityAgent is not set or
ConnectorFactory#create(String, File) is called with
identityAgent == null.
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the display name; properly localized and not emptyRetrieves a display name for a |
| public String | Returns: the internal name; not emptyRetrieves the internal name of a supported |
| getDisplayName | back to summary |
|---|---|
| public String getDisplayName() Retrieves a display name for a | |
| getIdentityAgent | back to summary |
|---|---|
| public String getIdentityAgent() Retrieves the internal name of a supported | |