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

bugfix(keycloak): fix parameters for realm key creation #8823

Merged

Conversation

fivetide
Copy link
Contributor

@fivetide fivetide commented Sep 2, 2024

SUMMARY

This fixes #7850. Realm key creation on keycloak side needs the parent_id to be either the ID of the realm or to be omitted. The modules mixed up the realm name - as used in the url - with the id, leading to invalid created entities. In addition the get_components request for getting the current state filtered with the same invalid value.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.general.keycloak_realm_key

@ansibullbot

This comment was marked as outdated.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug ci_verified Push fixes to PR branch to re-run CI module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit labels Sep 2, 2024
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Sep 2, 2024
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Sep 2, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch labels Sep 2, 2024
Copy link
Collaborator

@felixfontein felixfontein 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 your contribution! I've added some first comments.

changelogs/fragments/8823-keycloak-realm-key.yml Outdated Show resolved Hide resolved
@@ -371,7 +371,7 @@ def main():
parent_id = module.params.get('parent_id')

# Get a list of all Keycloak components that are of keyprovider type.
realm_keys = kc.get_components(urlencode(dict(type=provider_type, parent=parent_id)), parent_id)
realm_keys = kc.get_components(urlencode(dict(type=provider_type)), parent_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I wonder whether this is something that changed over time, and thus is still needed for older Keycloak versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a) looking at the oldest available docs (keycloak 21.0), this has always been optional
b) it is filtered to this realm scope anyways since .get_components requests from GET /{realm}/components

@felixfontein
Copy link
Collaborator

If nobody objects I'll merge this on this weekend for 9.4.0.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Sep 8, 2024
@felixfontein felixfontein merged commit ea389e7 into ansible-collections:main Sep 8, 2024
147 checks passed
Copy link

patchback bot commented Sep 8, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/ea389e70452f30cc8f800ed2bcc4f9eb36559bf2/pr-8823

Backported as #8839

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Sep 8, 2024
* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ea389e7)
@felixfontein
Copy link
Collaborator

@fivetide thanks for your contribution!

Copy link

patchback bot commented Sep 8, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/ea389e70452f30cc8f800ed2bcc4f9eb36559bf2/pr-8823

Backported as #8840

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Sep 8, 2024
* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ea389e7)
felixfontein pushed a commit that referenced this pull request Sep 8, 2024
…rs for realm key creation (#8840)

bugfix(keycloak): fix parameters for realm key creation (#8823)

* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ea389e7)

Co-authored-by: Björn Bösel <[email protected]>
felixfontein pushed a commit that referenced this pull request Sep 8, 2024
…rs for realm key creation (#8839)

bugfix(keycloak): fix parameters for realm key creation (#8823)

* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit ea389e7)

Co-authored-by: Björn Bösel <[email protected]>
aioue pushed a commit to aioue/community.general that referenced this pull request Oct 1, 2024
…ections#8823)

* bugfix(keycloak): fix parameters for realm key creation

* supply changelog fragment

* fix formatting

* fix formatting

* Update changelogs/fragments/8823-keycloak-realm-key.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keycloak_realm_key module creates key, but fails to create proper relation to realm
3 participants