Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softwarefactory-project/keycloak-event-listener-mqtt
A Keycloak SPI that publishes events to a MQTT broker.
https://github.com/softwarefactory-project/keycloak-event-listener-mqtt
Last synced: 4 months ago
JSON representation
A Keycloak SPI that publishes events to a MQTT broker.
- Host: GitHub
- URL: https://github.com/softwarefactory-project/keycloak-event-listener-mqtt
- Owner: softwarefactory-project
- License: apache-2.0
- Created: 2019-04-18T08:39:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T13:33:20.000Z (7 months ago)
- Last Synced: 2024-06-12T15:06:53.928Z (6 months ago)
- Language: Java
- Size: 60.5 KB
- Stars: 36
- Watchers: 5
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# keycloak-event-listener-mqtt
A Keycloak SPI that publishes events to a MQTT broker.
This SPI has been deployed successfully on a containerized Keycloak 22.0.
It should therefore work properly on any version of Keycloak above 22.0.# Build
```
mvn clean install
```To build the SPI for use with a version of Keycloak prior to 22.X, you need to use openjdk 11 and patch pom.xml to target java 11:
```
11
11
```# Deploy
## Keycloak on Wildfly
* Copy target/event-listener-mqtt-jar-with-dependencies.jar to {KEYCLOAK_HOME}/standalone/deployments
* Edit standalone.xml to configure the MQTT service settings. Find the following
section in the configuration:```
auth
```And add below:
```
```
Leave username and password out if the service allows anonymous write access.
If unset, the default message topic is "keycloak/events".
By default, the SPI won't use persistence. If set to true, messages will be persisted in memory.* Restart the keycloak server.
## Keycloak on Quarkus
* Copy the jar archive to /opt/keycloak/providers/ in the keycloak container.
* run keycloak with the following options:```
kc.sh start
--spi-events-listener-mqtt-server-uri tcp://your.mqtt.server:port \
--spi-events-listener-mqtt-publisher-id kc-mqtt \
--spi-events-listener-mqtt-username mqtt_user \
--spi-events-listener-mqtt-password mqtt_password \
--spi-events-listener-mqtt-topic my_topic \
--spi-events-listener-mqtt-use-persistence true \
--spi-events-listener-mqtt-retained true \
--spi-events-listener-mqtt-clean-session true \
--spi-events-listener-mqtt-qos 0
```# Trying it out
The Dockerfile in the `testing` directory can be used to build a keycloak container image
with the listener pre-installed. It assumes the compiled jar has been generated.The compose in the same directory will launch keycloak and a MQTT server; keycloak is configured
to publish to this server - however the listener must be enabled on any realm.The `demo.sh` script at the root of the repository automates all the steps above up to and
including configuring the master realm to publish events to the MQTT server, and can be used
to test the event listener out.