We have a use case when the user create a new realm (E.g.: “realmNew”)in Keycloak, some configs and resource in an existed realm (e.g.: all roles in “realmOld”) needs to be copied into the new created realm.
I did some research and found Keycloak provides SPI to implement the plugin which listen the specific event and do the operation. In my case, the event will be realm creation. When I try to implement the interface EventListenerProvider
in plugin, I found the method in this interface:
void onEvent(AdminEvent event, boolean includeRepresentation);
The input is the AdminEvent
class. So it means the listener has no way to access any internal resources of keycloak (E.g.: realm, roles, users …) In this case, it seems that the listener plugin based on Keycloak SPI won’t work for my design. I should find another approach.
Anyone has idea whether my understanding is correct ? Or any suggestions ?