[keycloak-dev] Issue with CacheModel

Marek Posolda mposolda at redhat.com
Tue Jul 15 08:38:08 EDT 2014


Hi,

During export/import I may want to remove some data (like realm) and 
overwrite it with imported one. But actually I have some issues during 
testing and looks like it's caused by the fact that not all the data are 
properly invalidated during removal of entities.

For example when removing realm, there is just realm itself marked for 
invalidation 
https://github.com/keycloak/keycloak/blob/master/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/DefaultCacheModelProvider.java#L268 
. Actually with JPA model, the call to  getDelegate().removeRealm(id) 
also seems to invalidate application and application roles (due to the 
call to getApplicationById() which uses CacheModel) but realm roles, 
oauth clients and users are not invalidated. For Mongo model, there are 
no data invalidated at all.

Question is if CacheModelProvider should rely on ModelProvider to 
invalidate cached data during getDelegate().removeRealm ? Shouldn't it 
be the responsibility of CacheModelProvider itself to find all cached 
data related to particular realm (in this case all applications, oauth 
clients, realm roles, app roles, users) and invalidate them?

Marek


More information about the keycloak-dev mailing list