-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/keycloak-dependency-problem'
- Loading branch information
Showing
2 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` | ||
|
||
--- |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.