-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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_authz_permission incorrectly sends a one element array as string #7151
Comments
Files identified in the description: If these files are incorrect, please update the |
The keycloak_authz_permission uses API endpoints and JSON payloads that are not officially documented. I basically created the only API documentation that exists by capturing the REST API calls made from the Admin Console: Given the unofficial status of this API (endpoint and payloads) I would not be surprised if Keycloak project might change them without warning. Now, what Keycloak version are you using? I developed the code against Keycloak 15.0.2 and could not spot any issues despite extensive integration tests. |
@mattock I'm testing against keycloak 22.0.0 |
@RobinGoussey I've been integration testing this module against 20.0.2 and have not noticed any problems. Maybe something broke in 21 or 22. Are you able to run the integration tests against 22.0.0 and if yes, do they pass? You need to run Keycloak in a container like this:
You should be able to replace "20.0.2" with "22.0.0". Then run the tests:
If there is an issue with 22.0.0 it should manifest itself in these tests. |
I'm also experiencing this issue with KC 22.0.1. I believe the problem isn't with KC, but the module incorrectly sending the "resources" element as a string instead of list. If you look at the module debug output, you can see it thinks its creating a list in the module args, even when setting the "resources" parameter as a string.:
However, looking at the json payload its sending to KC in Wireshark, it looks like this:
|
FWIW, manually using the REST api with the "resources" parameter as a list works.
json payload
|
Finally, looking at your integration test, there is no "resources" parameter for the "Create scope permission" test. I believe that resources are optional in the KC API, so its probably a valid test, just not in this case where you are trying to validate assigning a single resource to a permission (for which there is no test case). |
I can confirm this error exists with version 15.0.2.
|
Summary
When running:
It returns a 500, where java/keycloak prints:
Which means it expects an array, but it got a string.
Looking at the python code
community.general/plugins/modules/keycloak_authz_permission.py
Line 333 in 7721420
I think this should be wrapped in an array.
Issue Type
Bug Report
Component Name
community.general.keycloak_authz_permission
Ansible Version
Community.general Version
Configuration
OS / Environment
Ubuntu
Steps to Reproduce
Tweak variables, and run against a running keycloak.
Expected Results
The task should use the correct serialization format.
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: