当前位置: 首页>>代码示例>>Java>>正文


Java ServerFactoryManager类代码示例

本文整理汇总了Java中org.apache.sshd.server.ServerFactoryManager的典型用法代码示例。如果您正苦于以下问题:Java ServerFactoryManager类的具体用法?Java ServerFactoryManager怎么用?Java ServerFactoryManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerFactoryManager类属于org.apache.sshd.server包,在下文中一共展示了ServerFactoryManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AsyncUserAuthService

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
public AsyncUserAuthService(Session s) throws SshException {
    ValidateUtils.checkTrue(s instanceof ServerSession, "Server side service used on client side");
    if (s.isAuthenticated()) {
        throw new SshException("Session already authenticated");
    }

    this.session = (ServerSession) s;
    maxAuthRequests = session.getIntProperty(ServerFactoryManager.MAX_AUTH_REQUESTS, DEFAULT_MAX_AUTH_REQUESTS);

    ServerFactoryManager manager = getFactoryManager();
    userAuthFactories = new ArrayList<>(manager.getUserAuthFactories());
    // Get authentication methods
    authMethods = new ArrayList<>();

    String mths = FactoryManagerUtils.getString(manager, ServerFactoryManager.AUTH_METHODS);
    if (GenericUtils.isEmpty(mths)) {
        for (NamedFactory<UserAuth> uaf : manager.getUserAuthFactories()) {
            authMethods.add(new ArrayList<>(Collections.singletonList(uaf.getName())));
        }
    }
    else {
        for (String mthl : mths.split("\\s")) {
            authMethods.add(new ArrayList<>(Arrays.asList(mthl.split(","))));
        }
    }
    // Verify all required methods are supported
    for (List<String> l : authMethods) {
        for (String m : l) {
            NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(m, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
            if (factory == null) {
                throw new SshException("Configured method is not supported: " + m);
            }
        }
    }

    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("Authorized authentication methods: "+ NamedResource.Utils.getNames(userAuthFactories));
    }
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:40,代码来源:AsyncUserAuthService.java

示例2: setUp

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    sshd = setupTestServer();
    PropertyResolverUtils.updateProperty(sshd, ServerFactoryManager.WELCOME_BANNER, WELCOME);
    sshd.start();
    port = sshd.getPort();
}
 
开发者ID:termd,项目名称:termd,代码行数:8,代码来源:WelcomeBannerTest.java

示例3: setUp

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    sshd = setupTestServer();
    PropertyResolverUtils.updateProperty(sshd, ServerFactoryManager.AUTH_METHODS, UserAuthPublicKeyFactory.NAME);
    sshd.setPublickeyAuthenticator(new PublickeyAuthenticator() {
        @SuppressWarnings("synthetic-access")
        @Override
        public boolean authenticate(String username, PublicKey key, ServerSession session) {
            return delegate.authenticate(username, key, session);
        }
    });
    sshd.start();
    port = sshd.getPort();
}
 
开发者ID:termd,项目名称:termd,代码行数:15,代码来源:SinglePublicKeyAuthTest.java

示例4: getFactoryManager

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
private ServerFactoryManager getFactoryManager() {
    return session.getFactoryManager();
}
 
开发者ID:aeshell,项目名称:aesh-readline,代码行数:4,代码来源:AsyncUserAuthService.java

示例5: AsyncUserAuthService

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
public AsyncUserAuthService(Session s) throws SshException {
  ValidateUtils.checkTrue(s instanceof ServerSession, "Server side service used on client side");
  if (s.isAuthenticated()) {
    throw new SshException("Session already authenticated");
  }

  serverSession = (ServerSession) s;
  maxAuthRequests = PropertyResolverUtils.getIntProperty(s, ServerAuthenticationManager.MAX_AUTH_REQUESTS, ServerAuthenticationManager.DEFAULT_MAX_AUTH_REQUESTS);

  List<NamedFactory<UserAuth>> factories = ValidateUtils.checkNotNullAndNotEmpty(
      serverSession.getUserAuthFactories(), "No user auth factories for %s", s);
  userAuthFactories = new ArrayList<>(factories);
  // Get authentication methods
  authMethods = new ArrayList<>();

  String mths = PropertyResolverUtils.getString(s, ServerFactoryManager.AUTH_METHODS);
  if (GenericUtils.isEmpty(mths)) {
    for (NamedFactory<UserAuth> uaf : factories) {
      authMethods.add(new ArrayList<>(Collections.singletonList(uaf.getName())));
    }
  } else {
    if (log.isDebugEnabled()) {
      log.debug("ServerUserAuthService({}) using configured methods={}", s, mths);
    }
    for (String mthl : mths.split("\\s")) {
      authMethods.add(new ArrayList<>(Arrays.asList(GenericUtils.split(mthl, ','))));
    }
  }
  // Verify all required methods are supported
  for (List<String> l : authMethods) {
    for (String m : l) {
      NamedFactory<UserAuth> factory = NamedResource.Utils.findByName(m, String.CASE_INSENSITIVE_ORDER, userAuthFactories);
      if (factory == null) {
        throw new SshException("Configured method is not supported: " + m);
      }
    }
  }

  if (log.isDebugEnabled()) {
    log.debug("ServerUserAuthService({}) authorized authentication methods: {}",
        s, NamedResource.Utils.getNames(userAuthFactories));
  }
}
 
开发者ID:termd,项目名称:termd,代码行数:44,代码来源:AsyncUserAuthService.java

示例6: getFactoryManager

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
public ServerFactoryManager getFactoryManager() {
  return serverSession.getFactoryManager();
}
 
开发者ID:termd,项目名称:termd,代码行数:4,代码来源:AsyncUserAuthService.java

示例7: TestSession

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
public TestSession(ServerFactoryManager server, IoSession ioSession) throws Exception {
    super(server, ioSession);
}
 
开发者ID:termd,项目名称:termd,代码行数:4,代码来源:AuthenticationTest.java

示例8: hackVersion

import org.apache.sshd.server.ServerFactoryManager; //导入依赖的package包/类
private void hackVersion() {
	PropertyResolverUtils.updateProperty(sshd, ServerFactoryManager.SERVER_IDENTIFICATION, "SSHD");
}
 
开发者ID:ggrandes,项目名称:sftpserver,代码行数:4,代码来源:Server.java


注:本文中的org.apache.sshd.server.ServerFactoryManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。