vymalo/keycloak-webhook

Keycloak 22 support

rblaine95 opened this issue · 2 comments

Hi there

I tried to add this provider to Keycloak 22 and it seems to cause Keycloak to crash during init.

Would it be possible to add support for Keycloak 22?

Docker compose to replicate:

version: "3.8"
services:
  keycloak-init:
    image: curlimages/curl
    container_name: keycloak-init
    user: root
    command:
      - sh
      - -c
      - |
        curl -L \
          https://github.com/vymalo/keycloak-webhook/releases/download/v0.2.0/keycloak-webhook-0.2.0-all.jar \
          -o /providers/keycloak-webhook-0.2.0.jar \
        && chown 1000:1000 /providers/keycloak-webhook-0.2.0.jar
    volumes:
      - kc-providers:/providers

  db:
    image: postgres
    container_name: postgres
    ports:
      - 5432:5432
    environment:
      POSTGRES_DB: keycloak
      POSTGRES_USER: keycloak
      POSTGRES_PASSWORD: keycloak
    volumes:
      - postgres:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "keycloak"]
      interval: 10s
      timeout: 5s
      retries: 3

  keycloak:
    image: quay.io/keycloak/keycloak:22.0
    container_name: keycloak
    environment:
      WEBHOOK_EVENTS_TAKEN: "LOGIN,REGISTER,LOGOUT,UPDATE_PROFILE"
      WEBHOOK_HTTP_AUTH_USERNAME: webhooks
      WEBHOOK_HTTP_AUTH_PASSWORD: webhooks
      KC_DB_URL: jdbc:postgresql://db/keycloak
      KC_DB_USERNAME: keycloak
      KC_DB_PASSWORD: keycloak
      KC_HEALTH_ENABLED: true
      KC_HOSTNAME: keycloak
      KEYCLOAK_ADMIN: keycloak
      KEYCLOAK_ADMIN_PASSWORD: keycloak
    ports:
      - 0.0.0.0:8080:8080
    command:
      - "start-dev"
      - "--db=postgres"
      - "--features=declarative-user-profile"
      - "--spi-events-listener-jboss-logging-success-level=info"
      - "--spi-events-listener-jboss-logging-error-level=warn"
      # - "--log-level=DEBUG"
    depends_on:
      keycloak-init:
        condition: service_completed_successfully
      db:
        condition: service_healthy
    volumes:
      - kc-providers:/opt/keycloak/providers

  keycloak-health:
    image: curlimages/curl
    container_name: keycloak-health
    restart: "no"
    command: /bin/sh -c "until curl -fsS http://keycloak:8080/health/ready; do sleep 5; done"
    depends_on:
      keycloak:
        condition: service_started

volumes:
  kc-providers:
  postgres:
» docker compose up keycloak
[+] Running 5/0
 ✔ Network keycloak-webhook_default        Created                                                                                                                                                                                                                                                                                                                                    0.0s 
 ✔ Volume "keycloak-webhook_kc-providers"  Created                                                                                                                                                                                                                                                                                                                                    0.0s 
 ✔ Container postgres                      Created                                                                                                                                                                                                                                                                                                                                    0.0s 
 ✔ Container keycloak-init                 Created                                                                                                                                                                                                                                                                                                                                    0.0s 
 ✔ Container keycloak                      Created                                                                                                                                                                                                                                                                                                                                    0.0s 
Attaching to keycloak
keycloak  | Updating the configuration and installing your custom providers, if any. Please wait.
keycloak  | 2023-08-01 10:04:16,583 INFO  [org.keycloak.common.Profile] (main) Preview features enabled: declarative-user-profile
keycloak  | 2023-08-01 10:04:17,284 INFO  [org.keycloak.common.Profile] (main) Preview features enabled: declarative-user-profile
keycloak  | 2023-08-01 10:04:17,939 WARN  [org.keycloak.services] (build-16) KC-SERVICES0047: listener-webhook (com.vymalo.keycloak.webhook.WebhookEventListenerProviderFactory) is implementing the internal SPI eventsListener. This SPI is internal and may change without notice
keycloak  | 2023-08-01 10:04:20,771 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 3657ms
keycloak  | ERROR: Unexpected error when starting the server in (development) mode
keycloak  | ERROR: Failed to start quarkus
keycloak  | ERROR: kotlin/jvm/internal/Intrinsics
keycloak  | ERROR: kotlin.jvm.internal.Intrinsics
keycloak  | For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.
keycloak exited with code 1

So hello @rblaine95. I just fixed the problem with the v22 of Keycloak. The problem is that they removed the support for v11 and thus the Kotlin wasn't working anymore without the required std. I had it added and now it's fixed.

Awesome @stephane-segning, thank you!