Skip to content

fix: adding admin role invalidation when a new realm is found#46019

Merged
vmuzikar merged 4 commits into
keycloak:mainfrom
shawkins:iss45966
Feb 13, 2026
Merged

fix: adding admin role invalidation when a new realm is found#46019
vmuzikar merged 4 commits into
keycloak:mainfrom
shawkins:iss45966

Conversation

@shawkins

@shawkins shawkins commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

closes: #45966

In order to not require a restart on a new realm import there are two changes.

Whenever an admin performs an operation on the new realm, the new logic in RealmSessionCache will invalidate the master admin role if needed.

Then for that to be applicable to the current operation, it needs to also be taken into account for the MgmtPermissions role logic - the newly invalidated admin role is checked for new roles.

@shawkins shawkins force-pushed the iss45966 branch 4 times, most recently from 2149696 to c9db92b Compare February 10, 2026 20:16
@shawkins shawkins marked this pull request as ready for review February 10, 2026 20:16
@shawkins shawkins requested review from a team as code owners February 10, 2026 20:16
@shawkins shawkins requested a review from ahus1 February 10, 2026 20:16
shawkins and others added 4 commits February 11, 2026 07:35
closes: keycloak#45966

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
…ispan/RealmCacheSession.java

Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steve Hawkins <shawkins@redhat.com>

@ahus1 ahus1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all the investigation to find this solution, and thank you for implementing this.

@ahus1 ahus1 assigned ahus1 and unassigned ahus1 Feb 13, 2026

@vmuzikar vmuzikar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell (I'm not to familiar with this area), LGTM. Thank you, @shawkins.

@vmuzikar vmuzikar merged commit 19118a0 into keycloak:main Feb 13, 2026
87 checks passed
shawkins added a commit to shawkins/keycloak that referenced this pull request Feb 13, 2026
…ak#46019)

* fix: adding admin role invalidation when a new realm is found

closes: keycloak#45966

Signed-off-by: Steve Hawkins <shawkins@redhat.com>

* Update model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java

Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>

* adding a comment and a permission tweak for imported realms

Signed-off-by: Steve Hawkins <shawkins@redhat.com>

* checking getShouldUseLightweightToken

Signed-off-by: Steve Hawkins <shawkins@redhat.com>

---------

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Signed-off-by: Steven Hawkins <shawkins@redhat.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
(cherry picked from commit 19118a0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeycloakRealmImport: Realm created in DB but not visible in Admin Console until restart

3 participants