Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to disable bootstrap of admin account #165

Merged

Conversation

marioschlipf
Copy link
Contributor

I've came across a challenge when using this testcontainer in combination with importing realm configuration: Since the env variable for bootstrapping admin accounts are hardcoded, I cannot automatically import a full Keycloak configuration:

            withEnv("KC_BOOTSTRAP_ADMIN_USERNAME", adminUsername);
            withEnv("KC_BOOTSTRAP_ADMIN_PASSWORD", adminPassword);

Auto-importing configuration like so will fail, if the realm contains an admin user:

new KeycloakContainer()
            .withRealmImportFiles(MASTER_REALM_USERS_JSON))

The use case for this is that one might want to export and import a 1:1 export of a running keycloak installation for test reasons.

I've added a flag to disable this behavior, see the test.

@marioschlipf marioschlipf force-pushed the tech/mario/disable-bootstrap-admin branch from 484105c to 5488465 Compare November 5, 2024 18:03
@marioschlipf marioschlipf force-pushed the tech/mario/disable-bootstrap-admin branch from 5488465 to f2510aa Compare November 5, 2024 18:04
@dasniko dasniko self-requested a review November 6, 2024 11:51
Copy link
Owner

@dasniko dasniko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, generally LGTM and makes somehow sense with the new behavior.

There are some small issues, mentioned directly at the code, please review and fix it.
Additionally, there is some documentation missing. Please add a paragraph in the README file.

Thanks.

@marioschlipf marioschlipf force-pushed the tech/mario/disable-bootstrap-admin branch from eb7cce4 to b849a88 Compare November 6, 2024 18:33
@marioschlipf
Copy link
Contributor Author

marioschlipf commented Nov 6, 2024

Additionally, there is some documentation missing. Please add a paragraph in the README file.

Thanks, comments addressed and documentation amended. I moved the Initial admin user credentials section above the Realm Import so the added paragraph makes sense.

PS: Greetings from a fellow Darmstaedter :-)

Copy link
Owner

@dasniko dasniko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@marioschlipf
Copy link
Contributor Author

Thanks for the approval, I don't have the rights to merge though

@dasniko
Copy link
Owner

dasniko commented Nov 8, 2024

Yes, and that's good as this is my repo and would yield to a security issue if anybody would have merge rights.

Running the tests take some time and I don't have always this time to wait, so reviewing and merging are separate tasks at different times.
And before you ask - merging a new feature does not necessarily result in a new release. Be patient 🧘

@dasniko dasniko merged commit db1cb62 into dasniko:main Nov 8, 2024
1 check passed
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