本文整理汇总了Java中org.apache.sshd.common.ForwardingFilter类的典型用法代码示例。如果您正苦于以下问题:Java ForwardingFilter类的具体用法?Java ForwardingFilter怎么用?Java ForwardingFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForwardingFilter类属于org.apache.sshd.common包,在下文中一共展示了ForwardingFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: localPortForwardingRequested
import org.apache.sshd.common.ForwardingFilter; //导入依赖的package包/类
@Override
public synchronized SshdSocketAddress localPortForwardingRequested(SshdSocketAddress local) throws IOException {
if (local == null) {
throw new IllegalArgumentException("Local address is null");
}
if (local.getPort() < 0) {
throw new IllegalArgumentException("Invalid local port: " + local.getPort());
}
final ForwardingFilter filter = session.getFactoryManager().getTcpipForwardingFilter();
if (filter == null || !filter.canListen(local, session)) {
throw new IOException("Rejected address: " + local);
}
SshdSocketAddress bound = doBind(local);
localForwards.add(bound);
return bound;
}
示例2: testDenyFilter
import org.apache.sshd.common.ForwardingFilter; //导入依赖的package包/类
/**
* not a test.
*
* @param filter
*/
@Test(enabled = false)
public static void testDenyFilter(ForwardingFilter filter) {
Session session = Mockito.mock(Session.class);
SshdSocketAddress address = Mockito.mock(SshdSocketAddress.class);
Assert.assertFalse(filter.canForwardAgent(session));
Assert.assertFalse(filter.canForwardX11(session));
Assert.assertFalse(filter.canListen(address, session));
Assert.assertFalse(filter.canConnect(address, session));
}
示例3: testLocalForwardFilter
import org.apache.sshd.common.ForwardingFilter; //导入依赖的package包/类
/**
* not a test.
*
* @param filter
*/
@SuppressWarnings("boxing")
@Test(enabled = false)
public static void testLocalForwardFilter(ForwardingFilter filter, String hostname, int port, boolean expected) {
Session session = Mockito.mock(Session.class);
SshdSocketAddress address = Mockito.mock(SshdSocketAddress.class);
Mockito.when(address.getHostName()).thenReturn(hostname);
Mockito.when(address.getPort()).thenReturn(port);
Assert.assertFalse(filter.canForwardAgent(session));
Assert.assertFalse(filter.canForwardX11(session));
Assert.assertFalse(filter.canListen(address, session));
Assert.assertEquals(filter.canConnect(address, session), expected);
}
示例4: getForwardingFilter
import org.apache.sshd.common.ForwardingFilter; //导入依赖的package包/类
/**
*
* @return an implementation of {@link ForwardingFilter} that can be used to see if forwarding is allowed.
*/
ForwardingFilter getForwardingFilter();
示例5: getForwardingFilter
import org.apache.sshd.common.ForwardingFilter; //导入依赖的package包/类
@Override
public ForwardingFilter getForwardingFilter() {
if (isForwardingAllowed()) {
return new LocalForwardingFilter(artifactoryInfo.getArtifactoryHost(), artifactoryInfo.getArtifactoryPort());
} else {
return new DenyingForwardingFilter();
}
}