From 6d9e1fcbf5d7d59a25d22d7369c70c2d65cabb56 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Sat, 28 Nov 2026 14:30:20 +0000
Subject: [PATCH] Document phpLDAPadmin Docker setup and delegated access (#1342)
---
opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-directory.png | 0
opendj-doc-generated-ref/src/main/asciidoc/how-to/index.adoc | 1
opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-login.png | 0
opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java | 109 +++++++++++++++++++--
opendj-doc-generated-ref/src/main/asciidoc/how-to/phpldapadmin.adoc | 156 +++++++++++++++++++++++++++++++
5 files changed, 255 insertions(+), 11 deletions(-)
diff --git a/opendj-doc-generated-ref/src/main/asciidoc/how-to/index.adoc b/opendj-doc-generated-ref/src/main/asciidoc/how-to/index.adoc
index 0619b3c..c335cc9 100644
--- a/opendj-doc-generated-ref/src/main/asciidoc/how-to/index.adoc
+++ b/opendj-doc-generated-ref/src/main/asciidoc/how-to/index.adoc
@@ -28,6 +28,7 @@
include::./tasks.adoc[]
include::./kubernetes.adoc[]
+include::./phpldapadmin.adoc[]
include::./bcfks.adoc[]
include::./jdbc-backend.adoc[]
include::./embedded-ldap.adoc[]
diff --git a/opendj-doc-generated-ref/src/main/asciidoc/how-to/phpldapadmin.adoc b/opendj-doc-generated-ref/src/main/asciidoc/how-to/phpldapadmin.adoc
new file mode 100644
index 0000000..bf691ec
--- /dev/null
+++ b/opendj-doc-generated-ref/src/main/asciidoc/how-to/phpldapadmin.adoc
@@ -0,0 +1,156 @@
+////
+The contents of this file are subject to the terms of the Common Development and
+Distribution License (the License). You may not use this file except in compliance with the
+License.
+
+You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+specific language governing permission and limitations under the License.
+
+When distributing Covered Software, include this CDDL Header Notice in each file and include
+the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+Header, with the fields enclosed by brackets [] replaced by your own identifying
+information: "Portions copyright [year] [name of copyright owner]".
+
+Copyright 2026 3A Systems, LLC.
+////
+
+:table-caption!:
+
+ifndef::env-site[]
+[#how-to-phpldapadmin]
+endif::[]
+== Connect phpLDAPadmin to OpenDJ in Docker
+
+ifdef::env-site[]
+anchor:how-to-phpldapadmin[]
+endif::[]
+
+This recipe uses Docker Compose to run OpenDJ and phpLDAPadmin (PLA) v2 for local testing. PLA reaches OpenDJ at `opendj:1389` on the Compose network. The example uses plain LDAP on that network and publishes the PLA web interface over HTTP on the host's loopback address.
+
+=== Start OpenDJ and phpLDAPadmin
+
+In an empty directory, save the following as `compose.yaml`. OpenDJ creates the base entry `dc=example,dc=com` in a new instance. The named volume keeps the instance when you replace the container. See xref:../install-guide/chap-install.adoc#install-docker[Running OpenDJ in Docker].
+
+[source,yaml]
+----
+services:
+ opendj:
+ image: openidentityplatform/opendj:5.2.0
+ init: true
+ environment:
+ ROOT_PASSWORD: "${OPENDJ_ROOT_PASSWORD:?Set OPENDJ_ROOT_PASSWORD}"
+ ADD_BASE_ENTRY: --addBaseEntry
+ volumes:
+ - opendj-data:/opt/opendj/data
+ stop_grace_period: 60s
+ pla:
+ image: phpldapadmin/phpldapadmin:2.3.13
+ depends_on:
+ opendj:
+ condition: service_healthy
+ environment:
+ LDAP_HOST: opendj
+ LDAP_PORT: "1389"
+ LDAP_BASE_DN: "dc=example,dc=com"
+ LDAP_LOGIN_ATTR: DN
+ LDAP_LOGIN_OBJECTCLASS: inetOrgPerson
+ ports:
+ - "127.0.0.1:8080:8080"
+volumes:
+ opendj-data:
+----
+
+Set the initial password for `cn=Directory Manager` and run the commands in this recipe from the same Bash session.
+
+[source,bash]
+----
+read -r -s -p 'OpenDJ Directory Manager password: ' OPENDJ_ROOT_PASSWORD
+printf '\n'
+export OPENDJ_ROOT_PASSWORD
+docker compose up -d --wait
+----
+
+=== Create a PLA Login
+
+PLA needs an LDAP entry for the login DN. The default OpenDJ bind DN `cn=Directory Manager` is an alternate bind DN with no entry at that location. Use it to create the delegate with the `inetOrgPerson` object class configured in PLA. See the link:https://github.com/leenooks/phpLDAPadmin/wiki/FAQ[phpLDAPadmin FAQ] for the login requirements.
+
+[source,bash]
+----
+docker compose exec -T opendj /opt/opendj/bin/ldapmodify \
+ --hostname localhost --port 1389 --bindDN 'cn=Directory Manager' \
+ --bindPassword "$OPENDJ_ROOT_PASSWORD" <<'LDIF'
+dn: uid=pla-user,dc=example,dc=com
+changetype: add
+objectClass: inetOrgPerson
+uid: pla-user
+cn: PLA User
+sn: User
+userPassword: DemoPlaPassword123
+LDIF
+----
+
+=== Delegate Administration of the People Branch
+
+As `cn=Directory Manager`, create `ou=People,dc=example,dc=com` and add two access control instructions (ACIs) to it. The first ACI allows `pla-user` to add and delete `inetOrgPerson` entries below `ou=People`. The second allows updates to the listed attributes on those entries. The `password-reset` privilege and write access to `userPassword` together allow the delegate to reset passwords in this branch.
+
+[source,bash]
+----
+docker compose exec -T opendj /opt/opendj/bin/ldapmodify \
+ --hostname localhost --port 1389 --bindDN 'cn=Directory Manager' \
+ --bindPassword "$OPENDJ_ROOT_PASSWORD" <<'LDIF'
+dn: ou=People,dc=example,dc=com
+changetype: add
+objectClass: organizationalUnit
+ou: People
+
+dn: ou=People,dc=example,dc=com
+changetype: modify
+add: aci
+aci: (targetscope="subordinate")(targetfilter="(objectClass=inetOrgPerson)")
+ (version 3.0; acl "PLA manages People entries";
+ allow (add,delete) userdn="ldap:///uid=pla-user,dc=example,dc=com";)
+aci: (targetscope="subordinate")(targetfilter="(objectClass=inetOrgPerson)")
+ (targetattr="cn || sn || givenName || mail || telephoneNumber || description || userPassword")
+ (version 3.0; acl "PLA updates People profiles and passwords";
+ allow (write) userdn="ldap:///uid=pla-user,dc=example,dc=com";)
+-
+
+dn: uid=pla-user,dc=example,dc=com
+changetype: modify
+add: ds-privilege-name
+ds-privilege-name: password-reset
+-
+
+dn: uid=demo-user,ou=People,dc=example,dc=com
+changetype: add
+objectClass: inetOrgPerson
+uid: demo-user
+cn: Demo User
+sn: User
+mail: demo-user@example.com
+description: Demo account
+LDIF
+----
+
+If `ou=People` already exists, omit the first LDIF record. For more on how OpenDJ evaluates these rules, see xref:../admin-guide/chap-privileges-acis.adoc#aci-required[ACI Required For LDAP Operations] and xref:./delegate-password-reset.adoc[Delegate Password Reset Permissions].
+
+=== Sign In and Verify Access
+
+. Open link:http://127.0.0.1:8080/[phpLDAPadmin] in a browser.
+. Enter `uid=pla-user,dc=example,dc=com` in the *User ID* field and `DemoPlaPassword123` in the *Password* field. Click *Login*.
++
+image::images/phpldapadmin-login.png[phpLDAPadmin login form with the delegate's DN]
+. Open the sidebar if it is collapsed. Expand `dc=example,dc=com` and `ou=People` in the tree, then select `uid=demo-user`.
++
+image::images/phpldapadmin-directory.png[phpLDAPadmin directory tree with the demo user selected]
+. To verify the delegated write permission, click *Edit Entry* and change *Description*. Click *Update*, then click *Update* again to confirm the change.
+
+To stop the demo while keeping the directory data, run `docker compose down`.
+
+=== Connect to an Existing OpenDJ Server
+
+If OpenDJ already runs in Compose, add the `pla` service to that deployment and update `LDAP_HOST` and `depends_on` to use the OpenDJ service name. The health dependency requires an OpenDJ health check. For an OpenDJ server outside the Compose project, omit `depends_on` and use a hostname that resolves from the PLA container. If OpenDJ runs on a separate Docker network, attach PLA to that network as well.
+
+Set `LDAP_PORT` to the LDAP listener port reachable from PLA and `LDAP_BASE_DN` to an existing base entry. Sign in with the full DN of an existing LDAP user and set `LDAP_LOGIN_OBJECTCLASS` to an object class on that entry. If the server requires a bind to read the schema or find the login entry, set `LDAP_USERNAME` and `LDAP_PASSWORD` for a lookup account with that access.
+
+For an LDAPS listener, use `LDAP_CONNECTION: ldaps` and the listener port (1636 by default). Configure PLA to trust the certificate presented by OpenDJ. See xref:../admin-guide/chap-connection-handlers.adoc#setup-server-cert[Preparing for Secure Communications] and link:https://github.com/leenooks/phpLDAPadmin/wiki/Configuration-Variables[phpLDAPadmin configuration variables].
diff --git a/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-directory.png b/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-directory.png
new file mode 100644
index 0000000..7b67494
--- /dev/null
+++ b/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-directory.png
Binary files differ
diff --git a/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-login.png b/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-login.png
new file mode 100644
index 0000000..d6088c8
--- /dev/null
+++ b/opendj-doc-generated-ref/src/main/asciidoc/images/phpldapadmin-login.png
Binary files differ
diff --git a/opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java b/opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java
index f26257e..a70542a 100644
--- a/opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java
+++ b/opendj-doc-generated-ref/src/test/java/org/openidentityplatform/opendj/doc/AntoraPageTitlesIT.java
@@ -18,14 +18,21 @@
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Options;
import org.asciidoctor.SafeMode;
import org.asciidoctor.ast.Document;
import org.asciidoctor.ast.Section;
+import org.asciidoctor.extension.IncludeProcessor;
+import org.asciidoctor.extension.PreprocessorReader;
import org.forgerock.testng.ForgeRockTestCase;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -37,12 +44,16 @@
public class AntoraPageTitlesIT extends ForgeRockTestCase {
private Asciidoctor asciidoctor;
private File buildDirectory;
+ private Path modulesDirectory;
@BeforeClass
public void start() {
buildDirectory = new File(System.getProperty("docBuildDirectory",
new File(System.getProperty("basedir", "."), "target/asciidoc").getPath()));
+ modulesDirectory = buildDirectory.toPath().resolve("antora/modules");
asciidoctor = Asciidoctor.Factory.create();
+ asciidoctor.javaExtensionRegistry().includeProcessor(
+ new RootPartialIncludeProcessor(modulesDirectory.resolve("ROOT/partials")));
}
@AfterClass(alwaysRun = true)
@@ -75,23 +86,36 @@
"alias-dereferencing-example", "alias-dereferencing-troubleshooting" } },
{ "admin-guide", "chap-ldap-transactions", "LDAP Transactions (RFC 5805)",
new String[] { "chap-ldap-transactions", "ldap-transactions-discover", "ldap-transactions-use",
- "ldap-transactions-troubleshoot" } }
+ "ldap-transactions-troubleshoot" } },
+ { "how-to", "phpldapadmin", "Connect phpLDAPadmin to OpenDJ in Docker",
+ new String[] { "how-to-phpldapadmin", "_start_opendj_and_phpldapadmin", "_create_a_pla_login",
+ "_delegate_administration_of_the_people_branch", "_sign_in_and_verify_access",
+ "_connect_to_an_existing_opendj_server" } }
};
}
+ @Test
+ public void allGeneratedPagesHaveDocumentTitles() throws IOException {
+ final List<Path> pages;
+ try (Stream<Path> paths = Files.walk(modulesDirectory)) {
+ pages = paths.filter(Files::isRegularFile)
+ .map(modulesDirectory::relativize)
+ .filter(path -> path.getNameCount() >= 3 && "pages".equals(path.getName(1).toString()))
+ .filter(path -> path.getFileName().toString().endsWith(".adoc"))
+ .sorted()
+ .collect(Collectors.toList());
+ }
+ assertThat(pages).as("Antora pages in %s", modulesDirectory).isNotEmpty().allSatisfy(page -> {
+ final File input = modulesDirectory.resolve(page).toFile();
+ assertThat(readDocumentTitle(input)).as("document title of %s", page).isNotBlank();
+ });
+ }
+
@Test(dataProvider = "pages")
public void generatedPageHasDocumentTitle(String guide, String page, String title, String[] fragments) {
- final File input = new File(buildDirectory, "antora/modules/" + guide + "/pages/" + page + ".adoc");
+ final File input = modulesDirectory.resolve(guide + "/pages/" + page + ".adoc").toFile();
assertThat(input).isFile();
- // Antora extracts metadata from the header. A full parse can fall back to a section
- // title and conceal a missing document header, although Antora publishes "Untitled".
- final Document document = asciidoctor.loadFile(input,
- Options.builder().safe(SafeMode.SAFE).attributes(Map.of("env-site", ""))
- .parseHeaderOnly(true).build());
- assertThat(document.getDoctitle()).as("document title of %s", input).isEqualTo(title);
- // Without a header, Asciidoctor can still return the title attribute, which Antora ignores.
- assertThat(document.hasAttribute("title"))
- .as("%s must have a document header rather than a :title: attribute", input).isFalse();
+ assertThat(readDocumentTitle(input)).as("document title of %s", input).isEqualTo(title);
final String html = asciidoctor.convertFile(input,
Options.builder().safe(SafeMode.SAFE).attributes(Map.of("env-site", ""))
.standalone(false).toFile(false).build());
@@ -101,6 +125,69 @@
}
}
+ @DataProvider
+ public Object[][] documentTitles() {
+ return new Object[][] {
+ { "= Heading\n:title: Browser Title\n", "Browser Title" },
+ { ":title: Browser Title\n", null },
+ { "== Section\n", null }
+ };
+ }
+
+ @Test(dataProvider = "documentTitles")
+ public void readsTitleOnlyWhenDocumentHasHeader(String source, String expectedTitle) throws IOException {
+ final Path page = Files.createTempFile("antora-page-title-", ".adoc");
+ try {
+ Files.writeString(page, source);
+ assertThat(readDocumentTitle(page.toFile())).isEqualTo(expectedTitle);
+ } finally {
+ Files.delete(page);
+ }
+ }
+
+ private String readDocumentTitle(File input) {
+ // Antora extracts metadata from the header. A full parse can fall back to a section
+ // title and conceal a missing document header, although Antora publishes "Untitled".
+ final Document document = asciidoctor.loadFile(input,
+ Options.builder().safe(SafeMode.SAFE).attributes(Map.of("env-site", ""))
+ .parseHeaderOnly(true).build());
+ // Antora publishes the resolved title only when the document has a header section.
+ final boolean hasHeader = document.findBy(Map.of()).stream()
+ .filter(Section.class::isInstance)
+ .map(Section.class::cast)
+ .anyMatch(section -> "header".equals(section.getSectionName()));
+ return hasHeader ? document.getDoctitle() : null;
+ }
+
+ /** Resolves Antora's ROOT partials, which can supply a page header such as the dsconfig reference title. */
+ private static final class RootPartialIncludeProcessor extends IncludeProcessor {
+ private static final String PREFIX = "ROOT:partial$";
+ private final Path partialsDirectory;
+
+ private RootPartialIncludeProcessor(Path partialsDirectory) {
+ this.partialsDirectory = partialsDirectory.toAbsolutePath().normalize();
+ }
+
+ @Override
+ public boolean handles(String target) {
+ return target.startsWith(PREFIX);
+ }
+
+ @Override
+ public void process(Document document, PreprocessorReader reader, String target, Map<String, Object> attributes) {
+ final Path partial = partialsDirectory.resolve(target.substring(PREFIX.length())).normalize();
+ if (!partial.startsWith(partialsDirectory)) {
+ throw new IllegalArgumentException("Invalid Antora ROOT partial: " + target);
+ }
+ final String path = partial.toString();
+ try {
+ reader.pushInclude(Files.readString(partial), path, path, 1, attributes);
+ } catch (IOException e) {
+ throw new UncheckedIOException("Cannot read Antora partial " + partial, e);
+ }
+ }
+ }
+
@Test
public void releaseHistoryKeepsPublishedText() {
final String html = renderReleaseHistory();
--
Gitblit v1.10.0