[keycloak-dev] Issue with CacheModel

Marek Posolda mposolda at redhat.com
Tue Jul 15 10:52:13 EDT 2014


I've added workaround to DefaultCacheModel.removeRealm for invalidate 
realm roles as I needed that to have test passing. Feel free to fix more 
properly once you figure out:-)

Marek

On 15.7.2014 16:43, Bill Burke wrote:
> Ooops.  Good catch.
>
> On 7/15/2014 8:38 AM, Marek Posolda wrote:
>> 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
>> _______________________________________________
>> keycloak-dev mailing list
>> keycloak-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>



More information about the keycloak-dev mailing list