User cache eviction

Hi all,

I’m wondering why there’s not currently a way to evict a specific user from cache through Keycloak Admin REST API. As far as I can see, all users in realm cache eviction is available (POST /{realm}/clear-user-cache).

I know that org.keycloak.models.cache.UserCache already supports eviction by UserModel, but this is not exposed through the REST interface. I’m considering writing a custom rest resource providing this functionality, but as this strikes me as a “common” use case I wonder why this hasn’t come up yet.

Is there any reason why this would be a bad idea? Am I missing something?

Thanks in advance.

We are also interested in revoking a specific user cache entry. Are there any updates / suggestions on how this is best accomplished?

Thanks!

Maybe have a look at this extension : keycloak-extension-playground/CustomRealmResource.java at master · thomasdarimont/keycloak-extension-playground · GitHub