Examples of AgentImpl


Examples of org.apache.sshd.agent.local.AgentImpl

    private long pool;
    private long handle;
    private Thread thread;

    public AgentServer() {
        this(new AgentImpl());
    }
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

    }

    public void registerCommandSession(CommandSession session) {
        try {
            String user = (String) session.get("USER");
            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");
            String agentId = "local:" + user;
            session.put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, agentId);
            locals.put(agentId, agent);
        } catch (Throwable e) {
            LOGGER.warn("Error starting ssh agent for local console", e);
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

    }

    private static SshAgent startAgent(String user, URL privateKeyUrl) {
        InputStream is = null;
        try {
            SshAgent agent = new AgentImpl();
            is = privateKeyUrl.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            is.close();
            agent.addIdentity(keyPair, user);
            return agent;
        } catch (Throwable e) {
            close(is);
            System.err.println("Error starting ssh agent for: " + e.getMessage());
            return null;
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

    }

    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.local.AgentImpl

    }

    private static SshAgent startAgent(String user, URL privateKeyUrl, String keyFile) {
        InputStream is = null;
        try {
            SshAgent agent = new AgentImpl();
            is = privateKeyUrl.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            is.close();
            agent.addIdentity(keyPair, user);
           
            if (keyFile != null) {
                String[] keyFiles = new String[]{keyFile};
                FileKeyPairProvider fileKeyPairProvider = new FileKeyPairProvider(keyFiles);
                for (KeyPair key : fileKeyPairProvider.loadKeys()) {
                    agent.addIdentity(key, user);               
                }
            }
           
            return agent;
        } catch (Throwable e) {
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

    public void registerCommandSession(CommandSession session) {
        if (session != null) {
            try {
                String user = (String) session.get("USER");
                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");
                String agentId = "local:" + user;
                session.put(SshAgent.SSH_AUTHSOCKET_ENV_NAME, agentId);
                locals.put(agentId, agent);
            } catch (Throwable e) {
                LOGGER.warn("Error starting ssh agent for local console", e);
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

    }

    private static SshAgent startAgent(String user, URL privateKeyUrl) {
        InputStream is = null;
        try {
            SshAgent agent = new AgentImpl();
            is = privateKeyUrl.openStream();
            ObjectInputStream r = new ObjectInputStream(is);
            KeyPair keyPair = (KeyPair) r.readObject();
            is.close();
            agent.addIdentity(keyPair, user);
            return agent;
        } catch (Throwable e) {
            close(is);
            System.err.println("Error starting ssh agent for: " + e.getMessage());
            return null;
View Full Code Here

Examples of org.apache.sshd.agent.local.AgentImpl

        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.local.AgentImpl

    }

    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.local.AgentImpl

        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
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.