This is a custom event listener for Keycloak events. Its goal is to notify an admin about new user registrations via email.
mvn clean install
docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app maven:3-openjdk-11 mvn clean install
Copy the jar in the target folder to the /opt/keycloak/providers/
folder.
Or when using Docker mount the file ./custom-event-listener.jar:/opt/keycloak/providers/custom-event-listener.jar
Set the event listener
- Open up Keycloak administration console and select your realm
- Go to Realm Settings
- Go to the Events tab
- Click in the input box next to event listeners and a dropdown with all available event listeners will be shown. Select our newly created
custom_event_listener
After you have set up everything and configured the listener do the following:
- Open the web interface of Mailhog at http://localhost:8085
- Register a new user on keycloak
- Go to Mailhog and check that it catched a mail for the admin