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

Java DirectoryService类代码示例

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

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



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

示例1: createEnv

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * Creates an environment configuration for JNDI access.
 */
private Hashtable<Object, Object> createEnv() {
    // Fetch directory service from servlet context
    ServletContext servletContext = this.getServletContext();
    DirectoryService directoryService = (DirectoryService) servletContext.
            getAttribute(DirectoryService.JNDI_KEY);

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(DirectoryService.JNDI_KEY, directoryService);
    env.put(Context.PROVIDER_URL, "");
    env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.
            getName());

    env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
    env.put(Context.SECURITY_CREDENTIALS, "secret");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");

    return env;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:22,代码来源:ApacheDSRootDseServlet.java


示例2: setSchemaContext

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
private void setSchemaContext(KdcConfiguration configuration, DirectoryService service,
                              String connectionUser)
        throws DirectoryServerException {
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(DirectoryService.JNDI_KEY, service);
    env.put(Context.SECURITY_PRINCIPAL, connectionUser);
    env.put(Context.SECURITY_CREDENTIALS, configuration.getSystemAdminPassword());
    env.put(Context.SECURITY_AUTHENTICATION, ConfigurationConstants.SIMPLE_AUTHENTICATION);
    env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());

    env.put(Context.PROVIDER_URL, SchemaConstants.OU_SCHEMA);

    try {
        schemaRoot = new InitialLdapContext(env, null);
    } catch (NamingException e) {
        throw new DirectoryServerException(
                "Unable to create Schema context with user " + connectionUser, e);
    }

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


示例3: startKerberos

import org.apache.directory.server.core.DirectoryService; //导入依赖的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


示例4: addPartition

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
private static Partition addPartition(
    DirectoryService service, String partitionId, String partitionDn) throws Exception {
  final JdbmPartition partition = new JdbmPartition();
  partition.setId(partitionId);
  partition.setPartitionDir(new File(service.getWorkingDirectory(), partitionId));
  partition.setSuffix(partitionDn);
  service.addPartition(partition);
  return partition;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:10,代码来源:EmbeddedLdapServer.java


示例5: contextInitialized

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * Startup ApacheDS embedded.
 *
 * @param sce ServletContext event
 */
@Override
public void contextInitialized(final ServletContextEvent sce) {
    File workDir = (File) sce.getServletContext().getAttribute(
            "javax.servlet.context.tempdir");
    workDir = new File(workDir, "server-work");
    if (!workDir.mkdirs()) {
        throw new RuntimeException("Could not create " + workDir.
                getAbsolutePath());
    }

    Entry result;
    try {
        initDirectoryService(sce.getServletContext(), workDir);

        server = new LdapServer();
        server.setTransports(new TcpTransport(Integer.valueOf(
                sce.getServletContext().
                getInitParameter("testds.port"))));
        server.setDirectoryService(service);

        server.start();

        // store directoryService in context to provide it to servlets etc.
        sce.getServletContext().setAttribute(DirectoryService.JNDI_KEY,
                service);

        result = service.getAdminSession().lookup(new DN("o=isp"));
    } catch (Exception e) {
        sce.getServletContext().log("Fatal error in context init", e);
        throw new RuntimeException(e);
    }

    if (result == null) {
        throw new RuntimeException("Base DN not found");
    } else {
        sce.getServletContext().log(
                "ApacheDS startup completed succesfully");
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:45,代码来源:ApacheDSStartStopListener.java


示例6: getDirectoryService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * @return the directoryService
 */
public DirectoryService getDirectoryService() {
    return directoryService;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:7,代码来源:AbstractApacheDSServer.java


示例7: getService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/** Returns service instance of this server. */
public DirectoryService getService() {
  return service;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:5,代码来源:EmbeddedLdapServer.java


示例8: init

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
@Override
public void init(final KdcConfiguration configuration, LDAPServer ldapServer)
        throws DirectoryServerException {

    if (configuration == null) {
        throw new DirectoryServerException("Could not initialize KDC server. " +
                "KDC configurations are null");
    }

    if (ldapServer == null) {
        throw new DirectoryServerException("Could not initialize KDC server. " +
                "Directory service is null.");
    }

    if (!(ldapServer instanceof ApacheLDAPServer)) {
        throw new DirectoryServerException("Apache KDC server is only compatible with " +
                "ApacheLDAPServer");
    }

    ApacheLDAPServer apacheLDAP = (ApacheLDAPServer) ldapServer;

    this.kdcServer.setServiceName(configuration.getKdcName());
    this.kdcServer.setKdcPrincipal(configuration.getKdcPrinciple());
    this.kdcServer.setPrimaryRealm(configuration.getPrimaryRealm());
    this.kdcServer.setMaximumTicketLifetime(configuration.getMaxTicketLifeTime());
    this.kdcServer.setMaximumRenewableLifetime(configuration.getMaxRenewableLifeTime());
    this.kdcServer.setSearchBaseDn(configuration.getSearchBaseDomainName());
    this.kdcServer.setPaEncTimestampRequired(
            configuration.isPreAuthenticateTimeStampRequired());

    configureTransportHandlers(configuration);

    DirectoryService directoryService = apacheLDAP.getService();

    if (directoryService == null) {
        throw new DirectoryServerException("LDAP service is null. " +
                "Could not configure Kerberos.");
    }

    this.kdcServer.setDirectoryService(directoryService);

    setSchemaContext(configuration, directoryService, ldapServer.getConnectionDomainName());

    enableKerberoseSchema();

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


示例9: ApacheDirectoryPartitionManager

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
public ApacheDirectoryPartitionManager(DirectoryService directoryService, String wd) {
    this.directoryService = directoryService;
    this.workingDirectory = wd;
    this.partitionFactory = new JdbmPartitionFactory();
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:6,代码来源:ApacheDirectoryPartitionManager.java


示例10: getDirectoryService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public DirectoryService getDirectoryService()
        throws Exception {
    return directoryService;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:9,代码来源:CarbonDirectoryServiceFactory.java


示例11: getService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
public DirectoryService getService() {
    return service;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:4,代码来源:ApacheLDAPServer.java


示例12: setService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
public void setService(DirectoryService service) {
    this.service = service;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:4,代码来源:ApacheLDAPServer.java


示例13: EmbeddedLdapServer

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
private EmbeddedLdapServer(DirectoryService directoryService,
                           LdapServer ldapServer) {
    this.directoryService = directoryService;
    this.ldapServer = ldapServer;
}
 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:6,代码来源:EmbeddedLdapServer.java


示例14: setContexts

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * Sets the contexts for this base class. Values of user and password used to set the respective
 * JNDI properties. These values can be overriden by the overrides properties.
 *
 * @param user
 *            the username for authenticating as this user
 * @param passwd
 *            the password of the user
 * @throws Exception
 *             if there is a failure of any kind
 */
protected void setContexts(String user, String passwd) throws Exception {
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(DirectoryService.JNDI_KEY, getDirectoryService());
    env.put(Context.SECURITY_PRINCIPAL, user);
    env.put(Context.SECURITY_CREDENTIALS, passwd);
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName());
    setContexts(env);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:21,代码来源:AbstractApacheDSServer.java


示例15: setDirectoryService

import org.apache.directory.server.core.DirectoryService; //导入依赖的package包/类
/**
 * @param directoryService
 *            the directoryService to set
 */
public void setDirectoryService(DirectoryService directoryService) {
    this.directoryService = directoryService;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:8,代码来源:AbstractApacheDSServer.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java EnglishMinimalStemFilter类代码示例发布时间:2022-05-22
下一篇:
Java FileResolverImpl类代码示例发布时间: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