-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Automatically import all the required configurations into the K…
…eycloak and OpenFGA platforms. The new docker compose file, called 'docker-compose-import.yaml, uses the 'openfga/cli' image to import the OpenFga authorization schema
- Loading branch information
Showing
8 changed files
with
81 additions
and
163 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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3.8' | ||
|
||
services: | ||
openfga-import: | ||
depends_on: | ||
openfga: | ||
condition: service_healthy | ||
image: openfga/cli:v0.2.0 | ||
container_name: openfga-import | ||
restart: "no" | ||
command: "store create --name keycloak --api-url http://openfga:8080 --model /tmp/model.dsl" | ||
networks: | ||
- default | ||
volumes: | ||
- $PWD/openfga:/tmp | ||
keycloak-import: | ||
depends_on: | ||
openfga: | ||
condition: service_healthy | ||
keycloak: | ||
condition: service_healthy | ||
openfga-import: | ||
condition: service_completed_successfully | ||
image: quay.io/keycloak/keycloak:21.1 | ||
container_name: keycloak-import | ||
restart: "no" | ||
entrypoint: [ | ||
"sh", | ||
"-c", | ||
"echo 'Waiting 10 secs for importing Keycloak configuration...';sleep 10;/opt/keycloak/import.sh" | ||
] | ||
environment: | ||
KEYCLOAK_URL: http://keycloak:8081 | ||
KEYCLOAK_USER: admin | ||
KEYCLOAK_PASSWORD: password | ||
volumes: | ||
- $PWD/keycloak/initialize-poc.sh:/opt/keycloak/import.sh | ||
|
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
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 |
---|---|---|
|
@@ -2,7 +2,13 @@ | |
|
||
echo "Creating PoC Users, Role Model, User Role Assigments and Clients" | ||
|
||
/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8081 --realm master --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD | ||
/opt/keycloak/bin/kcadm.sh config credentials --server $KEYCLOAK_URL --realm master --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD | ||
|
||
# Enable openfga-events | ||
/opt/keycloak/bin/kcadm.sh update events/config -s 'eventsListeners=["openfga-events-publisher","jboss-logging"]' | ||
|
||
# Clients | ||
/opt/keycloak/bin/kcadm.sh create clients -r master -s clientId=portal -s publicClient=true -s 'redirectUris=["http://store:9090/callback"]' -s 'webOrigins=["http://store:9090"]' -s 'attributes={ "post.logout.redirect.uris": "http://store:9090/home?action=logout", "access.token.lifespan": 3600}' -o | ||
|
||
# Users | ||
/opt/keycloak/bin/kcadm.sh create users -r master -s username=paula -s firstName=Paula -s lastName=Von -s enabled=true -s [email protected] | ||
|
@@ -25,8 +31,3 @@ echo "Creating PoC Users, Role Model, User Role Assigments and Clients" | |
/opt/keycloak/bin/kcadm.sh add-roles -r master --uusername paula --rolename analyst-catalog | ||
/opt/keycloak/bin/kcadm.sh add-roles -r master --uusername richard --rolename admin-catalog | ||
|
||
|
||
# Clients | ||
/opt/keycloak/bin/kcadm.sh create clients -r master -s clientId=portal -s publicClient=true -s 'redirectUris=["http://store:9090/callback"]' -s 'webOrigins=["http://store:9090"]' -s 'attributes={ "post.logout.redirect.uris": "http://store:9090/home?action=logout", "access.token.lifespan": 3600}' -o | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
model | ||
schema 1.1 | ||
type group | ||
relations | ||
define assignee: [user] | ||
type role | ||
relations | ||
define assignee: [user] or assignee from parent or assignee from parent_group | ||
define parent: [role] | ||
define parent_group: [group] | ||
type user |
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,5 +1,6 @@ | ||
module.exports = { | ||
devServer: { | ||
disableHostCheck: true | ||
disableHostCheck: true, | ||
progress: false | ||
} | ||
} |