Examples of SshAgent


Examples of org.apache.sshd.agent.SshAgent

        System.exit(0);
    }

    protected static SshAgent startAgent(String user) {
        try {
            SshAgent local = new AgentImpl();
            URL url = Main.class.getClassLoader().getResource("karaf.key");
            InputStream is = url.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            local.addIdentity(keyPair, "karaf");
            return local;
        } catch (Throwable e) {
            System.err.println("Error starting ssh agent for: " + e.getMessage());
            return null;
        }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

        }
        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");
    }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

    }

    static class SshAgentLoader {
        static SshAgent load(BundleContext bundleContext) {
            try {
                SshAgent agent = new AgentImpl();
                URL url = bundleContext.getBundle().getResource("karaf.key");
                InputStream is = url.openStream();
                ObjectInputStream r = new ObjectInputStream(is);
                KeyPair keyPair = (KeyPair) r.readObject();
                agent.addIdentity(keyPair, "karaf");
                return agent;
            } catch (Throwable e) {
                LOGGER.warn("Error starting ssh agent for local console", e);
                return null;
            }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

            }
        }

        SshClient client = null;
        Terminal terminal = null;
        SshAgent agent = null;
        try {
            agent = startAgent(user);
            client = SshClient.setUpDefaultClient();
            client.setAgentFactory(new LocalAgentFactory(agent));
            client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local");
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

        System.exit(0);
    }

    protected static SshAgent startAgent(String user) {
        try {
            SshAgent local = new AgentImpl();
            URL url = Main.class.getClassLoader().getResource("karaf.key");
            InputStream is = url.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            local.addIdentity(keyPair, "karaf");
            return local;
        } catch (Throwable e) {
            System.err.println("Error starting ssh agent for: " + e.getMessage());
            return null;
        }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

        }
        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");
    }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

            }
        }

        SshClient client = null;
        Terminal terminal = null;
        SshAgent agent = null;
        int exitStatus = 0;
        try {
            agent = startAgent(user, keyFile);
            client = SshClient.setUpDefaultClient();
            client.setAgentFactory(new LocalAgentFactory(agent));
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

        System.exit(exitStatus);
    }

    protected static SshAgent startAgent(String user, String keyFile) {
        try {
            SshAgent local = new AgentImpl();

            URL builtInPrivateKey = Main.class.getClassLoader().getResource("karaf.key");
            InputStream is = builtInPrivateKey.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            is.close();
            local.addIdentity(keyPair, user);

            if (keyFile != null) {
                String[] keyFiles = new String[]{ keyFile };
                FileKeyPairProvider fileKeyPairProvider = new FileKeyPairProvider(keyFiles);
                for (KeyPair key : fileKeyPairProvider.loadKeys()) {
                    local.addIdentity(key, user);
                }
            }
            return local;
        } catch (Throwable e) {
            System.err.println("Error starting ssh agent for: " + e.getMessage());
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

    public UserAuthAgent(ClientSessionImpl session, String username) throws IOException {
        this.session = session;
        this.username = username;
        String authSocket = session.getFactoryManager().getProperties().get(SshAgent.SSH_AUTHSOCKET_ENV_NAME);
        SshAgent agent = new AgentClient(authSocket);
        this.agent = agent;
        keys = agent.getIdentities().iterator();
        sendNextKey();
    }
View Full Code Here

Examples of org.apache.sshd.agent.SshAgent

            }
        }

        SshClient client = null;
        Terminal terminal = null;
        SshAgent agent = null;
        try {
            agent = startAgent(user);
            client = SshClient.setUpDefaultClient();
            client.setAgentFactory(new LocalAgentFactory(agent));
            client.getProperties().put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, "local");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.