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

Conditionally Setting Policies Endpoints #469

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

osamaadam
Copy link
Contributor

In Keycloak versions >= 20.0.0. The endpoint to get/create/update the policies has been changed. It no longer includes the /policy-type part.

Similar to #286, I was facing this issue while running on Keycloak v24.0.1 and I couldn't use the policies endpoints.

So this PR checks the server version and conditionally adds the /policy-type part or omits it. If the Keycloak version is >=20.0.0 the part is omitted. In order to not hit the serverinfo endpoint everytime, I've added the version field to Gocloak.Config so the API would only have to be called once.

I've noticed that the tests on main are already failing so I haven't made any attempt to edit the test cases. Let me know if this will be a blocker. I've tested the policy fetching on v19.0.0 v20.0.0, v24.0.0 and it seems to work as intended in each one of these cases.

@osamaadam osamaadam marked this pull request as ready for review April 4, 2024 22:03
@Nerzal Nerzal merged commit 51c8e6f into Nerzal:main Nov 5, 2024
1 of 3 checks 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