In this article, we will share how to parameter RedHat SSO Keycloak SPI  adding a custom Event Listener module

1. Presentation

The goal of this article is to showcase the usage of SPI usage with keycloak. For this, it is illustrated with a very simple SPI example which an event listener.

2. Installing event Listener jar module

2.1) you need to find out event-listener-sysout-example.jar

~/keycloak_4.5/keycloak/examples/providers/event-listener-sysout/target/event-listener-sysout-example.jar

command:

2.2) adding event listener to keycloak providers

Goto standalone.xml and look-up for

2.3) restart keycloak server

sh standalone.sh

Check that event listener module has been loaded in the server.log file

 

2.4) Configure Event Listener in the corresponding Realm pannel

You need to select:

  •  Event Listener (Sysout here)
  • and save the whole

Optionally you can also specify to save events in the database.

3) Using the event Listener Log

Each Login/logout is tracked in the log file

 

4) Code of the event Listener SysoutEventListenerProvider.java

Code of SysoutEventListenerProviderFactory.java

 

5) Pointers

pointer:

https://github.com/keycloak/keycloak/tree/master/examples/providers/event-listener-sysout

Adding Event Listener (official instructions)

 

Olivier Rivat

Olivier Rivat

Senior Software Engineer with over 25 years of experience doing Software Development, Support and Consulting in Identity and Access Management Solutions.
Specialised in IAM (security, access control, identity management) and Open Source integration, settled in 2004 by IAM industry veteran, JANUA offers high value-added products and services to businesses and governements with a concern for Identity Management and Open Source components.
JANUA provides better security, build relationships, and enable new cloud, mobile, and IoT offerings from any device or connected thing.
Olivier Rivat

Les derniers articles par Olivier Rivat (tout voir)