Search in sources :

Example 1 with AgentDelegate

use of org.apache.sshd.agent.common.AgentDelegate in project karaf by apache.

the class KarafAgentFactory method createClient.

public SshAgent createClient(FactoryManager manager) throws IOException {
    String proxyId = (String) manager.getProperties().get(SshAgent.SSH_AUTHSOCKET_ENV_NAME);
    if (proxyId == null) {
        throw new IllegalStateException("No " + SshAgent.SSH_AUTHSOCKET_ENV_NAME + " environment variable set");
    }
    AgentServerProxy proxy = proxies.get(proxyId);
    if (proxy != null) {
        return proxy.createClient();
    }
    SshAgent agent = locals.get(proxyId);
    if (agent != null) {
        return new AgentDelegate(agent);
    }
    throw new IllegalStateException("No ssh agent found");
}
Also used : AgentDelegate(org.apache.sshd.agent.common.AgentDelegate) SshAgent(org.apache.sshd.agent.SshAgent) AgentServerProxy(org.apache.sshd.agent.local.AgentServerProxy)

Aggregations

SshAgent (org.apache.sshd.agent.SshAgent)1 AgentDelegate (org.apache.sshd.agent.common.AgentDelegate)1 AgentServerProxy (org.apache.sshd.agent.local.AgentServerProxy)1