DeepSeek V4.1 Flash · Balanced

add-caching-support-for-identityproviderstorageprovider-getforlogin-operations-keycloak

Keycloak · Java · M · 100–299 lines · 3 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
1 of 2
Comments published
3
Comments matching a bug
1
Comments not matching
2
Cost of this PR
$0.144

Published comments (3)

highbugserver-spi/src/main/java/org/keycloak/models/IdentityProviderStorageProvider.java:254

Organization clause in shared login predicate hides org-linked IDPs — `getLoginPredicate()` also backs `IdentityProviderBean.federatedProviderPredicate()`, so this clause silently hides org-linked IDPs without `BROKER_PUBLIC=true` from the linked-federated-identity list when organizations are disabled. Move the organization clause into the cache layer's invalidation predicate, not the shared login predicate.

mediumbugmodel/infinispan/src/main/java/org/keycloak/models/cache/infinispan/idp/InfinispanIdentityProviderStorageProvider.java:403-412

Login cache invalidation uses org-aware enabled state for original IDP — For an IDP bound to a disabled organization, `original.isEnabled()` is false even though the IDP sits in the login cache, so an update to `hideOnLogin` or `linkOnly` returns early and leaves stale entries. Test `getLoginPredicate()` on the stored model from `idpDelegate.getById(...)` instead of the wrapped `original`.

mediumperformancemodel/infinispan/src/main/java/org/keycloak/models/cache/infinispan/idp/InfinispanIdentityProviderStorageProvider.java:226-242

Login IDP cache key omits organizationId, causing unbounded entry growth — Keying the login cache by realm and `FetchMode` only lets each new `organizationId` grow the same `IdentityProviderListQuery` and evict the whole entry cluster-wide via `invalidateObject`, forcing DB reloads. Include `organizationId` in the key, as `cacheKeyOrgId` does for `getByOrganization`.

Gold bugs found (1)

highAdding the organization/BROKER_PUBLIC check to the shared LoginFilter.getLoginPredicate also changes IdentityProviderBean.federatedProviderPredicate, so with organizations disabled a user's linked IdP that has an organizationId but is not public is no longer shown on the login page.

Gold bugs missed (1)

lowThe test registers cleanup for the literal alias "alias" instead of the created IDP aliases, so the created identity providers are never cleaned up.