Update DevServices for Keycloak to create authorization policies #21276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #21040
This PR attempts to support running
keycloak-authorization
withDevServices for Keycloak
without having to import a custom realm.DevServices for Keycloak
creates a default realm, client, users, roles when no custom realm is added. With this PR, authorization permissions will also be added, so given only a configuration like this one:quarkus-quickstarts/security-keycloak-authoroization-quickstart
just works in the dev mode - a default useralice
who has bothadmin
anduser
roles can access bothapi/admin
andapi/users/me
, whilebob
- with only auser
role - can only accessapi/users/me
.@pedroigor, I've copied some code from
integration-tests/keycloak-authorization/.../KeycloakTestResource
to set up the basic permissions - for every configuredrole
andpath
pair inquarkus.keycloak.devservices.authorization.paths
this code is run, and more specifically this one (I'll clean it up a bit more - will try to generate unique names).Now, starting
quarkus-quickstarts/security-keycloak-authoroization-quickstart
with the above configuration andmvn quarkus:dev
produces:Pedro, can you help a bit and recommend what else may have to be added to the client registration code ? I guess I need to copy something else from KeycloakTestResource but I'm not sure what :-)
thanks