Package org.keycloak.events
Interface EventListenerProvider
- All Superinterfaces:
Provider
- All Known Subinterfaces:
EventStoreProvider
- All Known Implementing Classes:
EmailEventListenerProvider
,JBossLoggingEventListenerProvider
,JpaEventStoreProvider
- Author:
- Stian Thorgersen
This interface provides a way to listen to events that happen during the keycloak run.
There are two types of events:
- Event - User events (fired when users do some action, like log in, register etc.)
- Admin event - An administrator did some action like client created/updated etc.
onEvent
andonAdminEvent
are run within a running transaction. Hence, if the event processing uses JPA, it can insert event details into a table, and the whole transaction including the event is either committed or rolled back. However if transaction processing is not an option, e.g. in the case of log files, it is recommended to hook onto transaction after the commit is complete via theKeycloakTransactionManager.enlistAfterCompletion(KeycloakTransaction)
method, so that the events are stacked in memory and only written to the file after the original transaction completes successfully.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onEvent
(AdminEvent event, boolean includeRepresentation) Called when an admin event occurs e.g.void
Called when a user event occurs e.g.
-
Method Details
-
onEvent
Called when a user event occurs e.g. log in, register. Note this method should not do any action that cannot be rolled back, seeEventListenerProvider
javadoc for more details.- Parameters:
event
- to be triggered
-
onEvent
Called when an admin event occurs e.g. a client was updated/deleted. Note this method should not do any action that cannot be rolled back, seeEventListenerProvider
javadoc for more details.- Parameters:
event
- to be triggeredincludeRepresentation
- when false, event listener should NOT include representation field in the resulting action
-