-
Notifications
You must be signed in to change notification settings - Fork 1.7k
keycloak_client_rolescope: fix for issue #10342 #10343
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
base: main
Are you sure you want to change the base?
Conversation
hi @killianlevacher |
Hi @killianlevache, thank you for your contribution. It seems that the integration tests are currently failing. To help find a solution that addresses your use case without breaking compatibility, would you mind adding an integration test that reproduces the scenario you are trying to support? This would help me better understand the context. Thanks again! general/tests/integration/targets/keycloak_client_rolescopeTASK [keycloak_client_rolescope : Map roles to public client] ****************** |
I found this yesterday and commented on the bug report, because I think this module is not ment to manage roles in the context of |
…egration test would fail
@desand01 Apologies for only coming back to you now on this. It took me a while to dig into what was going on. For the purpose of this conversation, I commented out my suggested fixes and reverted to the original code to demonstrate the task failing. I also added steps in the integration test As pointed out in With the fix I am suggesting, when client_scope_id is provided with the scope_id (as opposed to a client name), the role is indeed assigned to the client scope as expected but the 'Map roles to public client' task fails probably for the reverse reasons (haven't been able to figure out why yet) Unless mistaken, somehow the underlying code seems to be confusing the notion of a client_scope_id with that of a client_id. For example in https://github.com/ansible-collections/community.general/blob/main/plugins/modules/keycloak_client_rolescope.py at line 205, the code checks whether I agree with @flvmz that it seems like this mapping should be in the client_scope module to start with. Perhaps, something which could clarify the confusion going on. Can someone explain, within the task called |
The test
The test
The test
The test
The test
The test
The test
The test
|
Hi @killianlevache. I believe part of the issue might be a confusion between the The current module is specifically intended to manage the client-side assignments ( To clarify, I think the support for realm-level client scopes ( Thanks again! |
Hi @desand01 Thanks for the clarification. So just to make sure I understand (because I'm starting to get lost now with the Keycloak terminology :D ). Does the collection currently allow a user to assign a client role to a a client scope as is possible in the Keycloak UI? or alternatively is there a way with the collection to assign roles of any type (realm role, private/public client roles) to a client scope? And if so what module should I use? If not, that's fine. I just want to make sure I fully understand the situation. Thanks in advance |
Sorry for the late response. As far as I can tell, there is no module in the official repo that allows mapping roles to a |
Hi @killianlevacher, Unfortunately, I think there is currently no module in the collection that allows you to manage client scopes at the realm level. As a workaround, you can use the keycloak_client_rolescope module to assign role scopes of another client directly to a client. However, this solution has some limitations—for example, it does not allow you to distinguish between default and optional scopes when assigning them. If your use case requires managing reusable client scope templates at the realm level and assigning them to clients (with support for default/optional designation), I suggest opening feature requests (Issues) for two new modules (names are only suggestions): keycloak_realm_client_scope: to manage client scope definitions and their role mappings at the realm level. |
Hi @killianlevacher, maybe this is what you are looking for: |
SUMMARY
this is a fix for issue #10342
Changelog Fragment:
This enables the
community.general.keycloak_client_rolescope
Ansible task to assign roles to client scopes in Keycloak, which currently fails because of a bug described in #10342ISSUE TYPE
COMPONENT NAME
community.general.keycloak_client_rolescope
ADDITIONAL INFORMATION
Steps to reproduce the bug described in details in #10342