Search in sources :

Example 1 with Session

use of org.apache.sshd.common.session.Session in project gerrit by GerritCodeReview.

the class SshDaemon method initForwarding.

private void initForwarding() {
    setTcpipForwardingFilter(new ForwardingFilter() {

        @Override
        public boolean canForwardAgent(Session session, String requestType) {
            return false;
        }

        @Override
        public boolean canForwardX11(Session session, String requestType) {
            return false;
        }

        @Override
        public boolean canListen(SshdSocketAddress address, Session session) {
            return false;
        }

        @Override
        public boolean canConnect(Type type, SshdSocketAddress address, Session session) {
            return false;
        }
    });
    setTcpipForwarderFactory(new DefaultTcpipForwarderFactory());
}
Also used : DefaultTcpipForwarderFactory(org.apache.sshd.common.forward.DefaultTcpipForwarderFactory) SshdSocketAddress(org.apache.sshd.common.util.net.SshdSocketAddress) ForwardingFilter(org.apache.sshd.server.forward.ForwardingFilter) MinaSession(org.apache.sshd.common.io.mina.MinaSession) Session(org.apache.sshd.common.session.Session) IoSession(org.apache.sshd.common.io.IoSession)

Example 2 with Session

use of org.apache.sshd.common.session.Session in project karaf by apache.

the class KarafAgentFactory method createServer.

public SshAgentServer createServer(ConnectionService service) throws IOException {
    Session session = service.getSession();
    if (!(session instanceof ServerSession)) {
        throw new IllegalStateException("The session used to create an agent server proxy must be a server session");
    }
    final AgentServerProxy proxy = new AgentServerProxy(service);
    proxies.put(proxy.getId(), proxy);
    return new SshAgentServer() {

        public String getId() {
            return proxy.getId();
        }

        @Override
        public boolean isOpen() {
            return proxy.isOpen();
        }

        public void close() throws IOException {
            proxies.remove(proxy.getId());
            proxy.close();
        }
    };
}
Also used : ServerSession(org.apache.sshd.server.session.ServerSession) SshAgentServer(org.apache.sshd.agent.SshAgentServer) AgentServerProxy(org.apache.sshd.agent.local.AgentServerProxy) ServerSession(org.apache.sshd.server.session.ServerSession) Session(org.apache.sshd.common.session.Session)

Aggregations

Session (org.apache.sshd.common.session.Session)2 SshAgentServer (org.apache.sshd.agent.SshAgentServer)1 AgentServerProxy (org.apache.sshd.agent.local.AgentServerProxy)1 DefaultTcpipForwarderFactory (org.apache.sshd.common.forward.DefaultTcpipForwarderFactory)1 IoSession (org.apache.sshd.common.io.IoSession)1 MinaSession (org.apache.sshd.common.io.mina.MinaSession)1 SshdSocketAddress (org.apache.sshd.common.util.net.SshdSocketAddress)1 ForwardingFilter (org.apache.sshd.server.forward.ForwardingFilter)1 ServerSession (org.apache.sshd.server.session.ServerSession)1