This custom event handler will subscribe to POST_AUTHENTICATION events and log the authenticated user name. Refer [1] for more details.
Tested with IS-5.7.0
- Stop the server if it is already running.
- Build the project using following command,
mvn clean install
- Copy the jar file org.wso2.custom.event.handler-1.0-SNAPSHOT.jar from the target directory to <IS_HOME>/repository/components/dropins folder.
- This event handler should be configured and subscribe to the POST_AUTHENTICATION event.
Open the identity-event.properties, in <IS_HOME>/repository/conf/identity/identity-event.properties file and add the following entries.
In this example 'module.name.13' is the next available module number, When you configure find the last 'module.name.#' and configure 'custom.event.handler' with the last module number +1
custom.event.handler.subscription.1=POST_AUTHENTICATION
- Start the server.
- Login to the IS management console. Eg : login with admin user credentials
- In the carbon logs you should be able to see
INFO {org.wso2.custom.event.handler.CustomEventHandler} - Custom event handler received events successfully.
INFO {org.wso2.custom.event.handler.CustomEventHandler} - Authenticated user : admin
[1] - https://medium.com/@isurakarunaratne/wso2-identity-server-eventing-framework-32505bcc1600