Skip to content

Commit

Permalink
MVP (#2)
Browse files Browse the repository at this point in the history
* feature(#1): Keycloak Event Listener SPI Plugin to send events (actions and admin) to temporal server/cloud

* feature(#1): Keycloak Event Listener SPI Plugin to send events (actions and admin) to temporal server/cloud, part 2

* chore(#1): Readme quick docs

* chore(#1): end of file line

Co-authored-by: Elan Hasson <[email protected]>

* chore(ci): #4 github setup-java maven cache

* chore(ci): #1 do package as it runs tests

---------

Co-authored-by: Elan Hasson <[email protected]>
  • Loading branch information
snovak7 and ElanHasson authored Apr 13, 2024
1 parent 0c08b43 commit 3d9b378
Show file tree
Hide file tree
Showing 18 changed files with 786 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[*.kt]
indent_size = tab
indent_style = space
tab_width = 4

[*.{yml,yaml}]
indent_style = space
tab_width = 2
indent_size = 2
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "maven"
directory: /
schedule:
interval: "daily"
labels:
- "dependencies"
groups:
keycloak:
patterns:
- "org.keycloak:*"
maven-plugins:
patterns:
- "org.apache.maven.plugins:*"
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on:
push:
branches:
- main
pull_request: {}
release:
types:
- published
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
cache: 'maven'
distribution: 'temurin'
java-version: '17'
- name: PR Check
if: github.event_name == 'pull_request'
run: mvn --batch-mode package
- name: Publish package
run: mvn --batch-mode deploy
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store

### Maven Extensions
/.git-versioned-pom.xml
/dependency-reduced-pom.xml
8 changes: 8 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>me.qoomon</groupId>
<artifactId>maven-git-versioning-extension</artifactId>
<version>9.6.6</version>
</extension>
</extensions>
36 changes: 36 additions & 0 deletions .mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://raw.githubusercontent.com/qoomon/maven-git-versioning-extension/master/docs/configuration-7.0.0.xsd">
<refs>
<ref type="branch">
<pattern>^dev(elop)?(ment)?$</pattern>
<version>${describe.tag.version.major}.${describe.tag.version.minor.next}.${describe.tag.version.patch}-beta.${describe.distance}</version>
</ref>

<ref type="branch">
<pattern>^releases?[/-]</pattern>
<version>${describe.tag.version.major}.${describe.tag.version.minor.next}.${describe.tag.version.patch}-rc.${describe.distance}-${feature}</version>
</ref>

<ref type="branch">
<pattern>^features?[/-]</pattern>
<version>${describe.tag.version.major}.${describe.tag.version.minor.next}.${describe.tag.version.patch}-alpha.${describe.distance}</version>
</ref>

<ref type="branch">
<pattern>^hotfix(es)?[/-]</pattern>
<version>${describe.tag.version.major}.${describe.tag.version.minor}.${describe.tag.version.patch.next}-beta.${describe.distance}</version>
</ref>

<ref type="tag">
<pattern><![CDATA[v(?<version>.*)]]></pattern>
<version>${ref.version}</version>
</ref>
</refs>

<!-- optional fallback configuration in case of no matching ref configuration-->
<rev>
<version>${describe.tag.version.major}.${describe.tag.version.minor.next}.${describe.tag.version.patch}-alpha.commit.${commit}</version>
</rev>
</configuration>
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,70 @@
# keycloak-event-listener-temporal
A Keycloak SPI Event Listener that publishes messages to Temporal Server
# Keycloak Event Listener for Temporal

This Keycloak SPI Event Listener integrates with Temporal Server, allowing you to publish events to it.

## Example Event

For instance, this is how an updated realm event triggered by an administrator might look:

- Queue: keycloak
- Namespace: default
- JSON:

```json
{
"id": "de158ae0-07d4-4581-b244-c85eee292c8c",
"time": 1712956881563,
"realmId": "40c965b1-ea85-4a21-85ee-0d6c86771279",
"authDetails": {
"realmId": "40c965b1-ea85-4a21-85ee-0d6c86771279",
"clientId": "a6ca059f-9726-483e-95e5-b1c0965aaf32",
"userId": "9548dde8-7089-4210-86f3-f0e03a215c01",
"ipAddress": null
},
"resourceType": "REALM",
"operationType": "UPDATE",
"resourcePath": "events/config",
"representation": null,
"error": null
}
```

## Installation

To get started:

1. [Download](https://github.com/InfinityFlowApp/keycloak-event-listener-temporal/releases) or build from source.
2. Copy the JAR file into your Keycloak installation.
3. Configure as described below.
4. Restart the Keycloak server.
5. Enable logging in the Keycloak UI by adding `event-listener-temporal`.


## Configuration

You can configure the listener using one of the following methods:


### Option 1: Command Parameters

Use the following command-line parameters:

| Parameter |
|--------------------------------------------------------------------|
| --spi-events-listener-event-listener-temporal-server=temporal:7233 |
| --spi-events-listener-event-listener-temporal-namespace=default |
| --spi-events-listener-event-listener-temporal-queue=keycloak |


### Option 2: Environment Variables

Alternatively, you can set these environmental variables:

| Variable | Value |
|---------------------------------------------------------|---------------|
| KC_SPI_EVENTS_LISTENER_EVENT_LISTENER_TEMPORAL_SERVER | temporal:7233 |
| KC_SPI_EVENTS_LISTENER_EVENT_LISTENER_TEMPORAL_NAMESPACE | default |
| KC_SPI_EVENTS_LISTENER_EVENT_LISTENER_TEMPORAL_QUEUE | keycloak |

# License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
Loading

0 comments on commit 3d9b378

Please sign in to comment.