Skip to content

Create base entry on external configuration store during setup#1045

Open
vharseko wants to merge 5 commits into
OpenIdentityPlatform:masterfrom
vharseko:issues/sel-ubuntu
Open

Create base entry on external configuration store during setup#1045
vharseko wants to merge 5 commits into
OpenIdentityPlatform:masterfrom
vharseko:issues/sel-ubuntu

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

OpenAM could not be installed against an external OpenDJ when the base DN
(root suffix, e.g. dc=openam,dc=example,dc=org) had not been created in advance.
Installation only succeeded when the directory was started with the OpenDJ
--addBaseEntry option (the ADD_BASE_ENTRY environment variable in the
OpenDJ Docker image).

This PR makes OpenAM create the base entry itself when it is missing, mirroring
the behaviour of the embedded configuration store (which creates the suffix via
openam_suffix.ldif). The --addBaseEntry / ADD_BASE_ENTRY workaround is no
longer required.

Problem

During setup against an external store:

  • AMSetupServlet.setupSMDatastore() only loaded schema/indexes (dsSmsSchema)
    but never created the root suffix.
  • The setup wizard validation (Step3.validateSMHost()) reported an error when
    the suffix was absent, leaving the Next button disabled.
  • The install-time validation (ServicesDefaultValues.setServiceConfigValues())
    failed with configurator.invalidsuffix when the suffix did not exist.

As a result the only way to proceed was to pre-create the base DN on the
directory server.

Changes

Product code (openam-core)

  • AMSetupDSConfig — added createBaseEntry(boolean ssl):
    • returns early when the suffix already exists (existence check),
    • derives the objectClass from the RDN naming attribute
      (dcdomain, oorganization, ouorganizationalUnit,
      otherwise extensibleObject),
    • is idempotent — handles ENTRY_ALREADY_EXISTS,
    • reports progress via SetupProgress and logs/raises ConfiguratorException
      on real failures.
  • AMSetupServlet.writeSchemaFiles() — calls createBaseEntry() before
    loading schema files for an external (SMS_DS_DATASTORE) configuration store.
  • ServicesDefaultValues.setServiceConfigValues() — creates the base entry
    instead of failing with configurator.invalidsuffix when the suffix is
    missing; only fails if creation does not result in a reachable suffix.
  • Step3.validateSMHost() (setup wizard) — treats a missing root suffix
    (NO_SUCH_OBJECT / EntryNotFoundException) as valid so the Next button
    is enabled; only real connection/authentication errors block progress.

Tests (openam-server)

  • IT_SetupWithOpenDJ — integration tests covering both scenarios against a
    Testcontainers OpenDJ:
    • testSetupWithOpendj — external OpenDJ without a pre-created base DN
      (OpenAM creates the base entry),
    • testSetupWithOpendjAddBaseEntry — external OpenDJ with a pre-created
      base DN (ADD_BASE_ENTRY=--addBaseEntry).
  • pom.xml — added a separate /am2 webapp context (an OpenAM instance can
    only be configured once per webapp), raised the Tomcat heap to -Xmx2g, and
    extended container startup / install timeouts.

Behaviour

Scenario Before After
External OpenDJ, base DN pre-created (--addBaseEntry) ✅ works ✅ works
External OpenDJ, base DN not created ❌ fails ✅ OpenAM creates the base entry
Embedded OpenDJ ✅ works (unchanged) ✅ works (unchanged)

Backward compatibility

No behavioural change for existing deployments where the base DN already exists
or --addBaseEntry is used — createBaseEntry() is a no-op in those cases.

Testing

  • IT_SetupWithOpenDJ — both new tests pass (with and without ADD_BASE_ENTRY).
  • Full integration suite: Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
    BUILD SUCCESS.

vharseko added 4 commits June 12, 2026 19:01
Allow OpenAM to be installed against an external OpenDJ when the base DN
(root suffix) has not been pre-created, removing the need for the OpenDJ
"--addBaseEntry" / ADD_BASE_ENTRY option.

- AMSetupDSConfig: add createBaseEntry() to create the root suffix when
  missing, deriving the objectClass from the RDN (dc/o/ou), with an
  existence check and ENTRY_ALREADY_EXISTS handling for idempotency.
- AMSetupServlet: call createBaseEntry() before loading schema files for
  an external (dsSmsSchema) configuration store, mirroring the embedded
  behaviour that creates the suffix via openam_suffix.ldif.
- ServicesDefaultValues: create the base entry instead of failing with
  configurator.invalidsuffix when the suffix does not yet exist.
- Step3 wizard: treat a missing root suffix (NO_SUCH_OBJECT) as valid so
  the Next button is enabled; only real connection/auth failures block.
- Add IT_SetupWithOpenDJ integration tests covering external OpenDJ both
  with and without a pre-created base DN; deploy a separate /am2 context,
  raise Tomcat heap to 2g and extend startup/install timeouts.
Allow OpenAM to be configured (including via ssoconfiguratortools) against
an external user-store directory whose base DN (root suffix) has not been
pre-created, removing the need for the OpenDJ "--addBaseEntry" option on the
user store.

The user store schema/initialisation LDIFs (e.g. opendj_userinit.ldif) add
entries such as "ou=people"/"ou=groups" under the user store root suffix but
assume the suffix itself already exists. When it did not, the configurator
failed with HTTP 500 while "Loading Schema opendj_userinit.ldif"
(NO_SUCH_OBJECT).

UserIdRepo.loadSchema() now creates the user store root suffix before loading
the schema files via a new createBaseEntry() helper that:
- checks for the base entry (BASE_OBJECT search) and is a no-op when present;
- derives the objectClass from the RDN (dc/o/ou, otherwise extensibleObject);
- is idempotent, handling ENTRY_ALREADY_EXISTS.

This mirrors the existing AMSetupDSConfig.createBaseEntry() behaviour added for
the external configuration store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants