[keycloak-user] EVENTTYPE for a temporarily disabled user

Dmitry Telegin dt at acutus.pro
Tue Nov 13 23:04:49 EST 2018


Hello Anneke,

I've encountered exactly the same problem about a year ago, also trying to collect custom metrics from Keycloak.

Matter is, all the data layer in Keycloak is accessed through the Infinispan facade. The idea is, if there is no built-in event type in Keycloak, you can still hook directly into the corresponding Infinispan cache and listen for its events. (Thanks Marek Posolda for pointing this out.)

The workflow is roughly the following:
- write a dummy provider (+factory);
- upon startup, use KeycloakSession::getProvider(InfinispanConnectionProvider.class) to retrieve default Infinispan connection;
- get users cache;
- get cache manager;
- call addListener to register your event handler.

Good luck,
Dmitry Telegin
CTO, Acutus s.r.o.
Keycloak Consulting and Training

Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
+42 (022) 888-30-71
E-mail: info at acutus.pro

On Tue, 2018-11-06 at 14:31 +0100, Anneke Breust wrote:
> Hi,
> 
> in context with customized Prometheus metrics I am looking for an Event, 
> which is emitted whenever a user is temporarily disabled (and a 
> counterpart, which is emitted when the disabled user is enabled again). 
> The goal is to be able to monitor the number of currently disabled users 
> as well as how many times in a specific time span a user has been 
> disabled. I looked through the EventTypes here 
> https://www.keycloak.org/docs-api/3.2/javadocs/org/keycloak/events/EventType.html 
> but I didn't find anything useful- did I overlook something?
> 
> 
> Thanks in advance,
> 
> Anneke
> 
> 
> 
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list