Package org.platformlayer.ops.ldap

Examples of org.platformlayer.ops.ldap.LdapDN$LdapDNComponent


  }

  public static LdapSchemaEntry build(String schemaName) {
    LdapSchemaEntry ldapSchemaEntry = OpsContext.get().getOpsSystem().getInjector()
        .getInstance(LdapSchemaEntry.class);
    LdapDN ldapDN = OpenLdapServer.CONFIG_DN.childDN(LdapAttributes.LDAP_ATTRIBUTE_CN, schemaName);
    ldapSchemaEntry.setLdapDN(ldapDN);
    ldapSchemaEntry.setSchemaFile(schemaName + ".schema");
    ldapSchemaEntry.setOnlyConfigureOnForce(true);
    return ldapSchemaEntry;
  }
View Full Code Here


  LdapDomain ldapDomain;

  LdapDomain getLdapDomain() throws OpsException {
    if (ldapDomain == null) {
      GitService model = OpsContext.get().getInstance(GitService.class);
      LdapDN ldapGroup = LdapDN.parseLdifEncoded(model.ldapGroup);

      LdapDomain best = null;
      for (LdapDomain candidate : platformLayer.listItems(LdapDomain.class)) {
        switch (candidate.getState()) {
        case DELETE_REQUESTED:
        case DELETED:
          continue;
        }

        LdapDN organizationName = LdapDN.fromDomainName(candidate.organizationName);

        if (!organizationName.isParentOf(ldapGroup)) {
          log.info("LdapDomain does not match: " + organizationName + " vs " + ldapGroup);
          continue;
        }

        log.info("Found matching LdapDomain: " + organizationName + " vs " + ldapGroup);
View Full Code Here

  @Override
  public void buildTemplateModel(Map<String, Object> model) throws OpsException {
    LdapDomain ldapDomain = getLdapDomain();
    LdapService ldapService = getLdapService();

    LdapDN organizationDN = LdapDN.fromDomainName(ldapDomain.organizationName);
    LdapDN allUsersDN = organizationDN.childDN("ou", "Users");
    LdapDN managerDN = organizationDN.childDN("cn", "Manager");
    LdapDN groupsDN = organizationDN.childDN("ou", "Groups");
    LdapDN gitUsersDN = groupsDN.childDN("cn", "Git");

    // String authLdapUrl = "ldap://192.168.192.67:389/ou=Users,dc=com,dc=fathomscale?uid";
    // String authLDAPBindDN = "cn=Manager,dc=com,dc=fathomscale";
    // String authLDAPBindPassword = "adminsecret";
    // String requireLdapGroup = "cn=Git,ou=Groups,dc=com,dc=fathomscale";

    int port = 389;
    List<EndpointInfo> endpoints = EndpointInfo.findEndpoints(ldapService.getTags(), port);

    EndpointInfo ldapEndpoint = EndpointChooser.preferIpv4().choose(endpoints);

    if (ldapEndpoint == null) {
      throw new OpsException("Cannot find suitable LDAP endpoint");
    }

    // TODO: Maybe we should just reference an LdapGroup

    // TODO: It sucks that we're logging in here as the Manager account

    // LdapGroup -> LdapDomain -> LdapService

    String authLdapUrl = "ldap://" + ldapEndpoint.publicIp + ":389/" + allUsersDN.toLdifEncoded() + "?uid";
    String authLDAPBindDN = managerDN.toLdifEncoded();
    String authLDAPBindPassword = ldapDomain.adminPassword.plaintext();
    String requireLdapGroup = gitUsersDN.toLdifEncoded();

    model.put("AuthLDAPURL", authLdapUrl);
    model.put("AuthLDAPBindDN", authLDAPBindDN);
    model.put("AuthLDAPBindPassword", authLDAPBindPassword);
    model.put("requireLdapGroup", requireLdapGroup);
View Full Code Here

  @Override
  protected void addChildren() throws OpsException {
    LdapDomain ldapDomain = OpsContext.get().getInstance(LdapDomain.class);
    String hostName = ldapDomain.organizationName;

    LdapDN ldapBase = LdapServerUtilities.createBaseDN(hostName);

    File dataRoot = new File("/var/ldap/data");
    File dataDir = new File(dataRoot, hostName);

    String ldapBaseOrganization = hostName;
View Full Code Here

  }

  private HdbDatabaseEntry buildDatabase(LdapDN ldapBase, File dataDir, String dbName) {
    HdbDatabaseEntry database = Injection.getInstance(HdbDatabaseEntry.class);

    database.setLdapDN(new LdapDN(LdapAttributes.LDAP_ATTRIBUTE_CN, "config").childDN("olcDatabase", "hdb"));
    database.setLdapRoot(ldapBase);
    database.setDataDirectory(dataDir);
    database.setDbName(dbName);

    database.setOnlyConfigureOnForce(true);
View Full Code Here

        // Ignore
        continue;
      }

      if (key.equals("dn")) {
        LdapDN ldapDN = LdapDN.parseLdifEncoded(value);
        current = new LdifRecord(ldapDN);
        records.add(current);
        continue;
      }
View Full Code Here

  protected LdifRecord queryCurrentRecord(OpsTarget target) throws OpsException {
    LdapService ldapService = OpsContext.get().getInstance(LdapService.class);
    String ldapPassword = ldapService.ldapServerPassword.plaintext();

    String filter = null;
    LdapDN searchBaseDN = getLdapDN();
    return OpenLdapManager.doLdapQuerySingle(target, OpenLdapServer.ADMIN_DN, ldapPassword, searchBaseDN, filter);
  }
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.ldap.LdapDN$LdapDNComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.