Skip to content

Commit

Permalink
Merge branch 'bugfix/keycloak-dependency-problem'
Browse files Browse the repository at this point in the history
  • Loading branch information
cevheri committed Mar 13, 2024
2 parents 261bb97 + 8b3b63c commit 43267cb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,85 @@
# Keycloak Extension - Custom Event Listener
# Keycloak Extension
## Custom Event Listener and API publisher

"User create" and "register" events, listen and Call Rest API with Java


---

### Clone :
```shell
git clone https://github.com/cevheri/keycloak-custom-event-listener

cd keycloak-custom-event-listener
```

---

### Generate JAR:
```shell
mvn clean package
```

---

### Attach keycloak dockerVolume (already in docker-compose file)
```yaml
volumes:
- ../../../target/custom-event-listener.jar://opt/jboss/keycloak/standalone/deployments/custom-event-listener.jar
```
---
### Run on Docker:
```shell
docker-compose -f src/main/docker/docker-compose.yml up -d
```

### Test :
#### First
---

### Keycloak Admin Console Configuration :
* Open Keycloak Admin Console
* Login with admin user
* Go to "Events" -> "Config" -> "Config" -> "Event Listeners"
* Add "custom-event-listener" to "Event Listeners"
* Save

![](files/event-configuration.png)

---

## Create New User:
* Go to "Users" -> "Add User"
* Fill the form and click "Save"
* Check the API result on MockAPI

#### Then
![](files/create-new-user.png)

---

#### API Design
![keycloak-event-listener-call-api.png](..%2F..%2F..%2FDocuments%2Fkeycloak-event-listener-call-api.png)
Hi-Level API Design
* Our motivation is to call an API when a user is created or registered.
* We will use a mock API for this example.

![keycloak-event-listener-call-api.png](files/keycloak-event-listener-call-api.png)

---

### Test Result on MockAPI:
#### Setup Mock API
![](files/mockapi-view-api.png)

---

#### View api result
![](files/mockapi-view-user.png)

---

### Stop Docker:
```shell
docker-compose -f src/main/docker/docker-compose.yml down
```

---
Binary file added files/keycloak-event-listener-call-api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 43267cb

Please sign in to comment.