Package org.platformlayer.service.openldap.model

Examples of org.platformlayer.service.openldap.model.LdapService


  }

  @Test
  public void testCreateAndDeleteItem() throws Exception {
    OpenLdapTestHelpers openLdap = new OpenLdapTestHelpers(getContext());
    LdapService ldapService = openLdap.createLdapServer();

    InetSocketAddress socketAddress = getUniqueEndpoint(ldapService);
    Assert.assertFalse(isPortOpen(socketAddress));

    openFirewall(ldapService, LdapServiceController.PORT);
View Full Code Here


  public void beforeCreateItem(ItemBase item) throws OpsException {
    super.beforeCreateItem(item);

    // TODO: This doesn't feel like the right place for this
    if (item instanceof LdapService) {
      LdapService ldapService = (LdapService) item;
      Passwords passwords = new Passwords();

      if (Secret.isNullOrEmpty(ldapService.ldapServerPassword)) {
        ldapService.ldapServerPassword = passwords.generateRandomPassword(12);
      }
View Full Code Here

  public LdapService createLdapServer() throws OpsException, IOException {
    String id = random.randomAlphanumericString(8);
    Secret ldapServerPassword = randomSecret();

    LdapService service = new LdapService();
    service.dnsName = id + ".test.platformlayer.org";
    service.ldapServerPassword = ldapServerPassword;

    service = context.putItem(id, service);
    service = context.waitForHealthy(service);
View Full Code Here

    // TODO: We keep creating dc=nodomain; we should remove it or stop it being created
  }

  @Override
  protected void addChildren() throws OpsException {
    LdapService model = OpsContext.get().getInstance(LdapService.class);

    // TODO: Support package pre-configuration??
    InstanceBuilder instance = InstanceBuilder.build(model.dnsName,
        DiskImageRecipeBuilder.loadDiskImageResource(getClass(), "DiskImageRecipe.xml"), model.getTags());
    addChild(instance);

    instance.addChild(MetricsInstance.class);

    instance.addChild(LdapMasterPassword.build(model.ldapServerPassword));

    {
      PublicEndpoint endpoint = injected(PublicEndpoint.class);
      // endpoint.network = null;
      endpoint.publicPort = PORT;
      endpoint.backendPort = PORT;
      endpoint.dnsName = model.dnsName;

      endpoint.tagItem = model.getKey();
      endpoint.parentItem = model.getKey();

      instance.addChild(endpoint);
    }
  }
View Full Code Here

  }

  @Test
  public void testCreateAndDeleteItem() throws Exception {
    OpenLdapTestHelpers openLdap = new OpenLdapTestHelpers(getContext());
    LdapService ldapService = openLdap.createLdapServer();

    openFirewall(ldapService, LdapServiceController.PORT);

    String organizationName = "test.platformlayer.org";
    LdapDomain ldapDomain = openLdap.createLdapDomain(ldapService, organizationName);
View Full Code Here

    }
    return true;
  }

  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

  LdapService getLdapService() throws OpsException {
    if (ldapService == null) {
      GitService model = OpsContext.get().getInstance(GitService.class);
      // String ldapGroup = model.ldapGroup;

      LdapService best = null;
      for (LdapService candidate : platformLayer.listItems(LdapService.class)) {
        switch (candidate.getState()) {
        case DELETE_REQUESTED:
        case DELETED:
          continue;
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");
View Full Code Here

TOP

Related Classes of org.platformlayer.service.openldap.model.LdapService

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.