Skip to content

RedFroggy/keycloak-event-listener-sns

Repository files navigation

keycloak-event-listener-sns


semantic-release


A Keycloak SPI that publishes events to an aws sns topic.

Statements Branches Functions Lines
Statements Branches Functions Lines

Features

  • Listen event on Keycloak
  • Send event on a topic aws sns

Compatibility

The version GitHub Release Date of this plugin is compatible with Keycloak 21.0.x and higher.

How to install?

Download a release (*.jar file) that works with your Keycloak version from the list of releases.

Server

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

Maven

You can also clone the Github Repository and install the plugin locally.

Container image (Docker)

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:

  1. package the code with aws dependencies, use maven 'docker-compose' profile to package
mvn package -P docker-compose
docker-compose up -d
  1. create .env file and add your own aws informations, put in environment of docker-compose file the corresponding key and secret key names.

How to use it

Requirements

Verify event listeners is deploy in keycloak. Got to {keycloak url}/admin/master/console/#/master/realm-settings/events.

server-info_event

Configuration

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"

enable_event-listener

required-actions-conf

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

Sns topic arn configuration

You have two possibilities to configure the event topic arn and admin event topic arn :

  1. use the .env file add your own aws informations about sns topic arn, put in environment 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}
  1. 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'

How to contribute

See here

About

A Keycloak SPI that publishes events to an aws sns topic

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages