Do not store RealmModel in cache entries

Closes #33439

Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
This commit is contained in:
Pedro Igor 2024-10-01 10:03:32 -03:00 committed by Alexander Schwartz
parent df89606b06
commit 3887ee3006
3 changed files with 8 additions and 12 deletions

View file

@ -23,18 +23,18 @@ import org.keycloak.models.cache.infinispan.entities.InRealm;
public class CachedIdentityProvider extends AbstractRevisioned implements InRealm { public class CachedIdentityProvider extends AbstractRevisioned implements InRealm {
private final RealmModel realm; private final String realm;
private final IdentityProviderModel idp; private final IdentityProviderModel idp;
public CachedIdentityProvider(Long revision, RealmModel realm, String cacheKey, IdentityProviderModel idp) { public CachedIdentityProvider(Long revision, RealmModel realm, String cacheKey, IdentityProviderModel idp) {
super(revision, cacheKey); super(revision, cacheKey);
this.realm = realm; this.realm = realm.getId();
this.idp = idp; this.idp = idp;
} }
@Override @Override
public String getRealm() { public String getRealm() {
return realm.getId(); return realm;
} }
public IdentityProviderModel getIdentityProvider() { public IdentityProviderModel getIdentityProvider() {

View file

@ -23,18 +23,18 @@ import org.keycloak.models.cache.infinispan.entities.InRealm;
public class CachedIdentityProviderMapper extends AbstractRevisioned implements InRealm { public class CachedIdentityProviderMapper extends AbstractRevisioned implements InRealm {
private final RealmModel realm; private final String realm;
private final IdentityProviderMapperModel mapper; private final IdentityProviderMapperModel mapper;
public CachedIdentityProviderMapper(Long revision, RealmModel realm, String cacheKey, IdentityProviderMapperModel mapper) { public CachedIdentityProviderMapper(Long revision, RealmModel realm, String cacheKey, IdentityProviderMapperModel mapper) {
super(revision, cacheKey); super(revision, cacheKey);
this.realm = realm; this.realm = realm.getId();
this.mapper = mapper; this.mapper = mapper;
} }
@Override @Override
public String getRealm() { public String getRealm() {
return realm.getId(); return realm;
} }
public IdentityProviderMapperModel getIdentityProviderMapper() { public IdentityProviderMapperModel getIdentityProviderMapper() {

View file

@ -32,7 +32,7 @@ import org.keycloak.models.cache.infinispan.entities.InRealm;
public class CachedOrganization extends AbstractRevisioned implements InRealm { public class CachedOrganization extends AbstractRevisioned implements InRealm {
private final RealmModel realm; private final String realm;
private final String name; private final String name;
private final String alias; private final String alias;
private final String description; private final String description;
@ -43,7 +43,7 @@ public class CachedOrganization extends AbstractRevisioned implements InRealm {
public CachedOrganization(Long revision, RealmModel realm, OrganizationModel organization) { public CachedOrganization(Long revision, RealmModel realm, OrganizationModel organization) {
super(revision, organization.getId()); super(revision, organization.getId());
this.realm = realm; this.realm = realm.getId();
this.name = organization.getName(); this.name = organization.getName();
this.alias = organization.getAlias(); this.alias = organization.getAlias();
this.description = organization.getDescription(); this.description = organization.getDescription();
@ -55,10 +55,6 @@ public class CachedOrganization extends AbstractRevisioned implements InRealm {
@Override @Override
public String getRealm() { public String getRealm() {
return realm.getId();
}
public RealmModel getRealmModel() {
return realm; return realm;
} }