Create base entry on external configuration store during setup#1045
Open
vharseko wants to merge 5 commits into
Open
Create base entry on external configuration store during setup#1045vharseko wants to merge 5 commits into
vharseko wants to merge 5 commits into
Conversation
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.
maximthomas
approved these changes
Jun 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
--addBaseEntryoption (theADD_BASE_ENTRYenvironment variable in theOpenDJ 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_ENTRYworkaround is nolonger required.
Problem
During setup against an external store:
AMSetupServlet.setupSMDatastore()only loaded schema/indexes (dsSmsSchema)but never created the root suffix.
Step3.validateSMHost()) reported an error whenthe suffix was absent, leaving the Next button disabled.
ServicesDefaultValues.setServiceConfigValues())failed with
configurator.invalidsuffixwhen 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— addedcreateBaseEntry(boolean ssl):objectClassfrom the RDN naming attribute(
dc→domain,o→organization,ou→organizationalUnit,otherwise
extensibleObject),ENTRY_ALREADY_EXISTS,SetupProgressand logs/raisesConfiguratorExceptionon real failures.
AMSetupServlet.writeSchemaFiles()— callscreateBaseEntry()beforeloading schema files for an external (
SMS_DS_DATASTORE) configuration store.ServicesDefaultValues.setServiceConfigValues()— creates the base entryinstead of failing with
configurator.invalidsuffixwhen the suffix ismissing; 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 buttonis enabled; only real connection/authentication errors block progress.
Tests (
openam-server)IT_SetupWithOpenDJ— integration tests covering both scenarios against aTestcontainers OpenDJ:
testSetupWithOpendj— external OpenDJ without a pre-created base DN(OpenAM creates the base entry),
testSetupWithOpendjAddBaseEntry— external OpenDJ with a pre-createdbase DN (
ADD_BASE_ENTRY=--addBaseEntry).pom.xml— added a separate/am2webapp context (an OpenAM instance canonly be configured once per webapp), raised the Tomcat heap to
-Xmx2g, andextended container startup / install timeouts.
Behaviour
--addBaseEntry)Backward compatibility
No behavioural change for existing deployments where the base DN already exists
or
--addBaseEntryis used —createBaseEntry()is a no-op in those cases.Testing
IT_SetupWithOpenDJ— both new tests pass (with and withoutADD_BASE_ENTRY).Tests run: 3, Failures: 0, Errors: 0, Skipped: 0—BUILD SUCCESS.