@Override public Collection<Identity> getIdentities() { if(!SSHAgentConnector.isConnectorAvailable()) { log.warn(String.format("SSH agent %s is not running", this)); return Collections.emptyList(); } if(null == proxy) { return Collections.emptyList(); } if(log.isDebugEnabled()) { log.debug(String.format("Retrieve identities from proxy %s", proxy)); } final List<Identity> identities = Arrays.asList(proxy.getIdentities()); if(log.isDebugEnabled()) { log.debug(String.format("Found %d identities", identities.size())); } return identities; }
public OpenSSHAgentAuthenticator() { try { proxy = new AgentProxy(new SSHAgentConnector(new JNAUSocketFactory())); } catch(AgentProxyException e) { log.warn(String.format("Agent proxy %s failed with %s", this, e)); } }