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

keycloak_realm: fix default groups and roles (#4241) #4719

Merged
merged 2 commits into from
May 30, 2022

Conversation

adam-cleo
Copy link
Contributor

SUMMARY

Fixes #4241

Fixed attributes default_roles and default_groups to match Keycloak API

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

keycloak_realm

ADDITIONAL INFORMATION

Only checked and fixed default_roles and default_groups

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug identity module module new_contributor Help guide this first time contributor plugins plugin (any type) labels May 23, 2022
@felixfontein
Copy link
Collaborator

Can you please add a changelog fragment? Thanks.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-4 labels May 24, 2022
@adam-cleo
Copy link
Contributor Author

Can you please add a changelog fragment? Thanks.

done 👍

@@ -0,0 +1,2 @@
bugfixes:
- "keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241)."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- "keycloak_realm - fix default groups and roles (https://github.com/ansible-collections/community.general/issues/4241)."
- "keycloak_realm - fix types for ``default_groups`` and ``default_roles`` options from lists of dictionaries to lists of strings (https://github.com/ansible-collections/community.general/issues/4241)."

@felixfontein
Copy link
Collaborator

@eikef @kris2kris @ndclt could you please take a look at this change? Thanks.

@kris2kris
Copy link
Contributor

Hi,
I'm ok with the fixes but it seems that default roles has been removed from keycloak API. The latest version with default roles parameter is v12.0 (https://www.keycloak.org/docs-api/12.0/rest-api/index.html#_realmrepresentation), it has been removed in v13.0 and now keycloak is in v18.0... maybe this parameter should be removed from keycloak_realm ?

@felixfontein
Copy link
Collaborator

@kris2kris that makes sense, but it needs to be deprecated first so it can be removed in a later version. I suggest the following:

  1. Merge this (so at least the types are correct);
  2. Someone creates a follow-up PR to deprecate this option, with removal scheduled for community.general 7.0.0 (standard two-major version deprecation cycle).

Does that sound good?

@felixfontein
Copy link
Collaborator

If nobody complains until in ~4 hours I'll merge this. (I'm planing to do a 5.0.1 release today around then, then this can go into that release.)

@felixfontein felixfontein merged commit 7ee15f9 into ansible-collections:main May 30, 2022
@patchback
Copy link

patchback bot commented May 30, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/7ee15f95f75ae9e9c0b592800cc2bdd299d84747/pr-4719

Backported as #4753

🤖 @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 May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)
@patchback
Copy link

patchback bot commented May 30, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/7ee15f95f75ae9e9c0b592800cc2bdd299d84747/pr-4719

Backported as #4754

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

@felixfontein
Copy link
Collaborator

@adam-cleo thanks for fixing this!
@kris2kris thanks for reviewing this!

patchback bot pushed a commit that referenced this pull request May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label May 30, 2022
felixfontein pushed a commit that referenced this pull request May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)

Co-authored-by: adam-cleo <[email protected]>
felixfontein pushed a commit that referenced this pull request May 30, 2022
* keycloak_realm: fix default groups and roles (#4241)

* add changelog fragment

(cherry picked from commit 7ee15f9)

Co-authored-by: adam-cleo <[email protected]>
@adam-cleo
Copy link
Contributor Author

adam-cleo commented Jun 3, 2022

Hi @kris2kris , @felixfontein ,

default realms was removed from official documentation. But it still flies under the radar in the latest version. They map the legacy value here . I tested that with version 16.1.1

So the way in current keycloak is to have one default and then add composites .

There are separate GET, POST, DELETE method to add the composites see here, but i guess it should be enough to send them in the main call with the RealmRepresentation ( defaultRole.composites)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug identity module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keycloak_realm: list of dicts should be list of strings
4 participants