Giter Site home page Giter Site logo

keycloak-event-listener-gcpubsub's Introduction

keycloak-event-listener-gcpubsub

A Keycloak SPI plugin that publishes events to Google Cloud Pub/Sub.

For example here is the notification of the user updated by administrator

  • attributes:
eventType: "ADMIN"
realmId: "MYREALM"
resourceType: "USER"
operationType: "UPDATE"
  • content:
{
  "@class" : "com.github.acesso_io.keycloak.event.provider.EventAdminNotificationGcpsMsg",
  "time" : 1596951200408,
  "realmId" : "MYREALM",
  "authDetails" : {
    "realmId" : "master",
    "clientId" : "********-****-****-****-**********",
    "userId" : "********-****-****-****-**********",
    "ipAddress" : "192.168.1.1"
  },
  "resourceType" : "USER",
  "operationType" : "UPDATE",
  "resourcePath" : "users/********-****-****-****-**********",
  "representation" : "representation details here....",
  "error" : null,
  "resourceTypeAsString" : "USER"
}

USAGE:

  1. Download the latest jar or build from source: mvn clean install
  2. copy jar into your Keycloak /opt/jboss/keycloak/standalone/deployments/keycloak-to-gcpubsub-1.0.jar
  3. Configure as described below (option 1 or 2 or 3)
  4. Restart the Keycloak server
  5. Enable logging in Keycloak UI by adding keycloak-to-gcpubsub
    Manage > Events > Config > Events Config > Event Listeners

Configuration

Set GOOGLE_APPLICATION_CREDENTIALS environment variable pointing to your service account credential file

OPTION 1: just configure ENVIRONMENT VARIABLES
  • KC_TO_GCP_PROJECTID - default: keycloak-test
  • KC_TO_GCP_EVENTTOPICID - default: keycloak-events
  • KC_TO_GCP_ADMINEVENTTOPICID - default: keycloak-events
OPTION 2: edit Keycloak subsystem of WildFly standalone.xml or standalone-ha.xml:
<spi name="eventsListener">
    <provider name="keycloak-to-gcpubsub" enabled="true">
        <properties>
            <property name="projectId" value="${env.KC_TO_GCP_PROJECTID:keycloak-test}"/>
            <property name="eventTopicId" value="${env.KC_TO_GCP_EVENTTOPICID:keycloak-events}"/>
            <property name="adminEventTopicId" value="${env.KC_TO_GCP_ADMINEVENTTOPICID:keycloak-events}"/>
        </properties>
    </provider>
</spi>
OPTION 3: same effect as OPTION 2 but programatically:
echo "yes" | $KEYCLOAK_HOME/bin/jboss-cli.sh --file=$KEYCLOAK_HOME/KEYCLOAK_TO_GCPUBSUB.cli 

keycloak-event-listener-gcpubsub's People

Contributors

dotbr avatar kirinse avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.