• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UdpTransport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getPort

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
/**
 * @return The underlying TCP transport port, or -1 if no transport has been 
 * initialized
 */
public int getPort()
{
    if ( transports == null )
    {
        return -1;
    }

    for ( Transport transport : transports )
    {
        if ( transport instanceof UdpTransport )
        {
            continue;
        }

        if ( !transport.isSSLEnabled() )
        {
            return transport.getPort();
        }
    }

    return -1;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:LdapServer.java


示例2: getPortSSL

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
/**
 * @return The underlying SSL enabled TCP transport port, or -1 if no transport has been 
 * initialized
 */
public int getPortSSL()
{
    if ( transports == null )
    {
        return -1;
    }

    for ( Transport transport : transports )
    {
        if ( transport instanceof UdpTransport )
        {
            continue;
        }

        if ( transport.isSSLEnabled() )
        {
            return transport.getPort();
        }
    }

    return -1;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:27,代码来源:LdapServer.java


示例3: configureTransportHandlers

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
private void configureTransportHandlers(KdcConfiguration configuration) {

        int port = getServerPort(configuration);
        if (configuration.getKdcCommunicationProtocol() ==
                KdcConfiguration.ProtocolType.UDP_PROTOCOL) {

            logger.info("Starting KDC on UDP mode at port - " + port + " at host - " +
                    configuration.getKdcHostAddress());

            UdpTransport defaultTransport = new UdpTransport(port);
            this.kdcServer.addTransports(defaultTransport);

        } else {

            logger.info("Starting KDC on a TCP port " + port + " at host " +
                    configuration.getKdcHostAddress());
            Transport tcp =
                    new TcpTransport(configuration.getKdcHostAddress(), port,
                            configuration.getNumberOfThreads(),
                            configuration.getBackLogCount());
            this.kdcServer.addTransports(tcp);

        }
    }
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:25,代码来源:ApacheKDCServer.java


示例4: startKerberos

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
@SuppressWarnings("unused")
private ApacheDS startKerberos() throws Exception {
  Preconditions.checkState(ldapServer.isStarted());

  kdcServer.setDirectoryService(directoryService);
  // FIXME hard-coded ports
  kdcServer.setTransports(new TcpTransport(6088), new UdpTransport(6088));
  kdcServer.setEnabled(true);
  kdcServer.setPrimaryRealm(realm);
  kdcServer.setSearchBaseDn(baseDn);
  kdcServer.setKdcPrincipal("krbtgt/" + realm + "@" + baseDn);
  kdcServer.start();

  // -------------------------------------------------------------------
  // Enable the krb5kdc schema
  // -------------------------------------------------------------------

  Hashtable<String, Object> env = new Hashtable<String, Object>();
  env.put(DirectoryService.JNDI_KEY, directoryService);
  env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
  env.put(Context.PROVIDER_URL, ServerDNConstants.OU_SCHEMA_DN);
  InitialLdapContext schemaRoot = new InitialLdapContext(env, null);

  // check if krb5kdc is disabled
  Attributes krb5kdcAttrs = schemaRoot.getAttributes("cn=Krb5kdc");
  boolean isKrb5KdcDisabled = false;
  if (krb5kdcAttrs.get("m-disabled") != null) {
    isKrb5KdcDisabled = ((String) krb5kdcAttrs.get("m-disabled").get()).equalsIgnoreCase("TRUE");
  }

  // if krb5kdc is disabled then enable it
  if (isKrb5KdcDisabled) {
    Attribute disabled = new BasicAttribute("m-disabled");
    ModificationItem[] mods = new ModificationItem[] {new ModificationItem(DirContext.REMOVE_ATTRIBUTE, disabled)};
    schemaRoot.modifyAttributes("cn=Krb5kdc", mods);
  }
  return this;
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-activedirectory,代码行数:39,代码来源:ApacheDS.java


示例5: createTransport

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
private static Transport createTransport( CreateTransport transportBuilder, int startPort )
{
    String protocol = transportBuilder.protocol();
    int port = transportBuilder.port();
    int nbThreads = transportBuilder.nbThreads();
    int backlog = transportBuilder.backlog();
    String address = transportBuilder.address();

    if ( port == -1 )
    {
        port = AvailablePortFinder.getNextAvailable( startPort );
        startPort = port + 1;
    }

    if ( protocol.equalsIgnoreCase( "TCP" ) )
    {
        Transport tcp = new TcpTransport( address, port, nbThreads, backlog );
        return tcp;
    }
    else if ( protocol.equalsIgnoreCase( "UDP" ) )
    {
        UdpTransport udp = new UdpTransport( address, port );
        return udp;
    }
    else
    {
        throw new IllegalArgumentException( I18n.err( I18n.ERR_689, protocol ) );
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:30,代码来源:KDCServerAnnotationProcessor.java


示例6: initKDCServer

import org.apache.directory.server.protocol.shared.transport.UdpTransport; //导入依赖的package包/类
private void initKDCServer() throws Exception {
  String orgName= conf.getProperty(ORG_NAME);
  String orgDomain = conf.getProperty(ORG_DOMAIN);
  String bindAddress = conf.getProperty(KDC_BIND_ADDRESS);
  final Map<String, String> map = new HashMap<String, String>();
  map.put("0", orgName.toLowerCase());
  map.put("1", orgDomain.toLowerCase());
  map.put("2", orgName.toUpperCase());
  map.put("3", orgDomain.toUpperCase());
  map.put("4", bindAddress);

  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  InputStream is = cl.getResourceAsStream("minikdc.ldiff");

  SchemaManager schemaManager = ds.getSchemaManager();
  final String content = StrSubstitutor.replace(IOUtils.toString(is), map);
  LdifReader reader = new LdifReader(new StringReader(content));
  try {
    for (LdifEntry ldifEntry : reader) {
      ds.getAdminSession().add(new DefaultEntry(schemaManager,
              ldifEntry.getEntry()));
    }
  } finally {
    reader.close();
  }

  kdc = new KdcServer();
  kdc.setDirectoryService(ds);

  // transport
  String transport = conf.getProperty(TRANSPORT);
  if (transport.trim().equals("TCP")) {
    kdc.addTransports(new TcpTransport(bindAddress, port, 3, 50));
  } else if (transport.trim().equals("UDP")) {
    kdc.addTransports(new UdpTransport(port));
  } else {
    throw new IllegalArgumentException("Invalid transport: " + transport);
  }
  kdc.setServiceName(conf.getProperty(INSTANCE));
  kdc.getConfig().setMaximumRenewableLifetime(
          Long.parseLong(conf.getProperty(MAX_RENEWABLE_LIFETIME)));
  kdc.getConfig().setMaximumTicketLifetime(
          Long.parseLong(conf.getProperty(MAX_TICKET_LIFETIME)));

  kdc.getConfig().setPaEncTimestampRequired(false);
  kdc.start();

  StringBuilder sb = new StringBuilder();
  is = cl.getResourceAsStream("minikdc-krb5.conf");
  BufferedReader r = new BufferedReader(new InputStreamReader(is));
  String line = r.readLine();
  while (line != null) {
    sb.append(line).append("{3}");
    line = r.readLine();
  }
  r.close();
  krb5conf = new File(workDir, "krb5.conf").getAbsoluteFile();
  FileUtils.writeStringToFile(krb5conf,
          MessageFormat.format(sb.toString(), getRealm(), getHost(),
                  Integer.toString(getPort()), System.getProperty("line.separator")));
  System.setProperty("java.security.krb5.conf", krb5conf.getAbsolutePath());

  System.setProperty("sun.security.krb5.debug", conf.getProperty(DEBUG,
          "false"));

  // refresh the config
  Class<?> classRef;
  if (System.getProperty("java.vendor").contains("IBM")) {
    classRef = Class.forName("com.ibm.security.krb5.internal.Config");
  } else {
    classRef = Class.forName("sun.security.krb5.Config");
  }
  Method refreshMethod = classRef.getMethod("refresh", new Class[0]);
  refreshMethod.invoke(classRef, new Object[0]);

  LOG.info("MiniKdc listening at port: {}", getPort());
  LOG.info("MiniKdc setting JVM krb5.conf to: {}",
          krb5conf.getAbsolutePath());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:80,代码来源:MiniKdc.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PipeType类代码示例发布时间:2022-05-22
下一篇:
Java PostingsFormat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap