rmf
rmf

Reputation: 55

Keycloak 13 to 14 default roles processing upgrade

I'm upgrading keycloak from 12 to 14. In 13 there was a change to default role processing:

https://github.com/keycloak/keycloak/commit/1402d021deb014310027ba506e6cfa7686b315b4

My existing code no longer works as expected:

enter image description here

I am trying to figure out how to update this code (adding a default realm role) to work with keycloak 13/14, I don't think the code below is on the right track (when I tried to get the default role again after the update, I did not see the new role I added inside it), can anyone help?

enter image description here

Upvotes: 0

Views: 438

Answers (1)

dreamcrash
dreamcrash

Reputation: 51603

If I am not mistaken, with Keycloak 14 you can access the default roles with:

keycloak.realm(/** Realm Name **/)
        .roles()
        .get(Constants.DEFAULT_ROLES_ROLE_PREFIX + "-" + /** Realm Name **/);

where Constants.DEFAULT_ROLES_ROLE_PREFIX is currently "default-roles"

Upvotes: 1

Related Questions