com.jcraft.jsch.agentproxy.connector.SSHAgentConnector Java Examples

The following examples show how to use com.jcraft.jsch.agentproxy.connector.SSHAgentConnector. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenSSHAgentAuthenticator.java    From cyberduck with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: OpenSSHAgentAuthenticator.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
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));
    }
}