Skip to content

Manual Installation

Dennis edited this page May 21, 2020 · 1 revision

This page is to keep the documentation of the initial manual installation.

Installation

Add a new provider in standalone.xml under <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">.

<providers>
    <provider>classpath:${jboss.home.dir}/providers/*</provider>
    <provider>module:com.github.snuk87.keycloak.keycloak-kafka</provider>
</providers>

Create a new folder in $KEYCLOAK_HOME/modules/system/layers/keycloak/com/github/snuk87/keycloak/keycloak-kafka/main

Copy keycloak-kafka-1.0.0.jar into the main folder and create a new file module.xml with the following content:

<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.3" name="com.github.snuk87.keycloak.keycloak-kafka">
 <resources>
  <resource-root path="keycloak-kafka-1.0.0.jar" />
 </resources>
 <dependencies>
  <module name="org.keycloak.keycloak-core"/>
  <module name="org.keycloak.keycloak-server-spi"/>
  <module name="org.keycloak.keycloak-server-spi-private"/>
  <module name="com.fasterxml.jackson.core.jackson-core"/>
  <module name="com.fasterxml.jackson.core.jackson-databind"/>
  <module name="org.jboss.logging"/>
  <module name="org.apache.kafka.kafka-clients"/>
 </dependencies>
</module>

Create a new folder in $KEYCLOAK_HOME/modules/system/layers/keycloak/org/apache/kafka/kafka-clients/main and create a new file module.xml.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.kafka.kafka-clients">
    <resources>
        <resource-root path="kafka-clients-2.2.0.jar"/>
        <resource-root path="lz4-java-1.5.0.jar"/>
        <resource-root path="snappy-java-1.1.7.2.jar"/>
    </resources>
    <dependencies>
        <module name="org.slf4j"/>
    </dependencies>
</module>

Download the .jar files listed under <resources> from MVN Repository and put them into the same folder.

.
├── kafka-clients-2.2.0.jar
├── lz4-java-1.5.0.jar
├── module.xml
├── snappy-java-1.1.7.2.jar
└── zstd-jni-1.3.8-1.jar

Configuration

Add the following content to your standalone.xml:

<spi name="eventsListener">
    <provider name="kafka" enabled="true">
        <properties>
            <property name="topicEvents" value="keycloak-events"/>
            <property name="clientId" value="keycloak"/>
            <property name="bootstrapServers" value="192.168.0.1:9092,192.168.0.2:9092"/>
            <property name="events" value="REGISTER,LOGIN,LOGOUT"/>
            <property name="topicAdminEvents" value="keycloak-admin-events"/>
        </properties>
    </provider>
</spi>

topicEvents: The name of the kafka topic to where the events will be produced to.

clientId: The client.id used to identify the client in kafka.

bootstrapServer: A comma separated list of available brokers.

events: (Optional; default=REGISTER) The events that will be send to kafka.

topicAdminEvents: (Optional) The name of the kafka topic to where the admin events will be produced to.

Clone this wiki locally