use of org.apache.sshd.agent.local.LocalAgentFactory in project karaf by apache.
the class DeployMojo method setupAgent.
private void setupAgent(String user, File keyFile, SshClient client) {
URL builtInPrivateKey = ClientMojo.class.getClassLoader().getResource("karaf.key");
SshAgent agent = startAgent(user, builtInPrivateKey, keyFile);
client.setAgentFactory(new LocalAgentFactory(agent));
client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local");
}
use of org.apache.sshd.agent.local.LocalAgentFactory in project karaf by apache.
the class ClientMojo method setupAgent.
private void setupAgent(String user, File keyFile, SshClient client) {
URL builtInPrivateKey = ClientMojo.class.getClassLoader().getResource("karaf.key");
SshAgent agent = startAgent(user, builtInPrivateKey, keyFile);
client.setAgentFactory(new LocalAgentFactory(agent));
client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local");
}
use of org.apache.sshd.agent.local.LocalAgentFactory in project karaf by apache.
the class Main method setupAgent.
private static void setupAgent(String user, String keyFile, SshClient client, FilePasswordProvider passwordProvider) {
SshAgent agent;
URL builtInPrivateKey = Main.class.getClassLoader().getResource("karaf.key");
agent = startAgent(user, builtInPrivateKey, keyFile, passwordProvider);
client.setAgentFactory(new LocalAgentFactory(agent));
client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local");
}
use of org.apache.sshd.agent.local.LocalAgentFactory in project platformlayer by platformlayer.
the class MinaSshConnection method buildAgentConnection.
@Override
public SshConnection buildAgentConnection(KeyPair agentKeyPair) throws IOException, SshException {
LocalAgentFactory agentFactory = new LocalAgentFactory();
SshAgent agent = agentFactory.getAgent();
try {
agent.addIdentity(agentKeyPair, "default");
} catch (IOException e) {
throw new IllegalArgumentException("Error adding agent identity", e);
}
MinaSshConnection agentConnection = new MinaSshConnection(new MinaSshContext(agentFactory));
agentConnection.setHost(this.getHost());
agentConnection.setPort(this.getPort());
agentConnection.setUser(this.getUser());
agentConnection.setServerKeyVerifier(this.getServerKeyVerifier());
agentConnection.setKeyPair(this.getKeyPair());
agentConnection.ensureConnected();
return agentConnection;
}
Aggregations