A Keycloak SPI that publishes events to an aws sns topic.
Statements | Branches | Functions | Lines |
---|---|---|---|
- Listen event on Keycloak
- Send event on a topic aws sns
The version of this plugin is compatible with Keycloak 21.0.x
and higher.
Download a release (*.jar file) that works with your Keycloak version from the list of releases.
Copy the jar to the providers
folder and execute the following command:
${kc.home.dir}/bin/kc.sh build
Note: the jars files are available directly on releases
You can also clone the Github Repository and install the plugin locally.
For Docker-based setups mount or copy the jar to /opt/keycloak/providers
.
You may want to check docker-compose.yml as an example.
with docker-compose:
- package the code with aws dependencies, use maven 'docker-compose' profile to package
mvn package -P docker-compose
docker-compose up -d
- create .env file and add your own aws informations, put in
environment
of docker-compose file the corresponding key and secret key names.
Verify event listeners is deploy in keycloak. Got to {keycloak url}/admin/master/console/#/master/realm-settings/events.
Once the installation is complete, the aws-sns
event listener appears in "
realm-settings/events" on your realm. Add and save to enable "AWS-SNS", remove and save to disable "AWS-SNS"
Once enabled, all of the actions in your account (details updat, login, logout,...) will be published on aws sns topic.
See Keycloak class Event for details of published elements
You have two possibilities to configure the event topic arn and admin event topic arn :
- use the
.env
file add your own aws informations about sns topic arn, put inenvironment
of docker-compose file the corresponding event topic arn and admin event topic arn names.
- KC_SNS_EVENT_TOPIC_ARN=${KC_SNS_EVENT_TOPIC_ARN-TODO}
- KC_SNS_ADMIN_EVENT_TOPIC_ARN=${KC_SNS_ADMIN_EVENT_TOPIC_ARN-TODO}
- use the following lines in
command
in docker-compose file
'--spi-events-listener-aws-sns-event-topic-arn=TODO',
'--spi-events-listener-aws-sns-admin-event-topic-arn=TODO'