keycloak / keycloak

Open Source Identity and Access Management For Modern Applications and Services
https://www.keycloak.org
Apache License 2.0
23.85k stars 6.84k forks source link

Custom EventType #15288

Open tobimuell opened 2 years ago

tobimuell commented 2 years ago

Description

I would like to extend the EventType in org.keycloak.events by some custom events. Unfortunately the EventType is currently an enum.

Discussion

https://github.com/keycloak/keycloak/discussions/15213

Motivation

I would like to combine two keycloak extensions loosely coupled via a custom EventType. To guarantee that no side effects occur we do not want to use existing EventType.

Details

Introducing an Interface called e.g. EventType that with Method isSaveByDefault and Rename the current EventType to DefaultEventType or StandardEventType. This could still be an enum implement the new interface EventType. If someone need a custom eventtype he only has to implement another enum / class which implements this new interface.

Note: Current events have a unique/stable index, so it follows that someone using custom events must make sure that the existing index is not overwritten!

vramik commented 2 years ago

Relates to https://github.com/keycloak/keycloak/issues/12485

dominiktopp commented 1 year ago

+1 Our Keycloak extension uses scheduled tasks to disable users after a specified duration with no login. When a user gets disabled we are sending an email using email-spi and we need to store an event about the mail. Unfortunately there is no appropriate EventType we could use. As a workaround we abuse the EventType.CUSTOM_REQUIRED_ACTION (could have been any other type as well) and add details about the sent mail. But those events are not easy to find in the admin ui if you are looking for a specific sent mail.

A custom event type would solve this: we could define our own "user-disabled" event type and search all events by type.