Skip to content

Commit

Permalink
Fixes in the Keycloak settings
Browse files Browse the repository at this point in the history
  • Loading branch information
abbradar committed Sep 28, 2024
1 parent f690360 commit dfa2ced
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:

keycloak:
image: keycloak/keycloak:25.0
entrypoint: /usr/local/bin/entrypoint.sh
restart: unless-stopped
environment:
KC_DB: postgres
Expand All @@ -29,8 +30,11 @@ services:
KC_HEALTH_ENABLED: "true"
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: "${KEYCLOAK_ADMIN_PASSWORD:-admin}"

EXTERNAL_ORIGIN: "${EXTERNAL_ORIGIN:-http://localhost:9080}"
volumes:
- ./docker/keycloak-realm.json:/opt/keycloak/data/import/realm.json:ro
- ./docker/keycloak-realm.json:/etc/keycloak/realm.json:ro
- ./docker/keycloak-entrypoint.sh:/usr/local/bin/entrypoint.sh
command: ["start", "--import-realm"]
depends_on:
- postgres
Expand Down
9 changes: 9 additions & 0 deletions docker/keycloak-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -e

mkdir -p /opt/keycloak/data/import
sed /etc/keycloak/realm.json \
-e 's,{EXTERNAL_ORIGIN},'"$EXTERNAL_ORIGIN"',g' \
> /opt/keycloak/data/import/realm.json

exec /opt/keycloak/bin/kc.sh "$@"
8 changes: 4 additions & 4 deletions docker/keycloak-realm.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"clientId": "ozma",
"enabled": true,
"clientAuthenticatorType": "client-secret",
"redirectUris": ["http://localhost:9000/auth_response"],
"webOrigins": ["http://localhost:9000"],
"redirectUris": ["{EXTERNAL_ORIGIN}/auth_response"],
"webOrigins": ["{EXTERNAL_ORIGIN}"],
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": false,
Expand All @@ -50,8 +50,8 @@
"clientId": "ozma-report-generator",
"enabled": true,
"clientAuthenticatorType": "client-secret",
"redirectUris": ["http://localhost:9000/report-generator/signin-oidc"],
"webOrigins": ["http://localhost:9000"],
"redirectUris": ["{EXTERNAL_ORIGIN}/report-generator/signin-oidc"],
"webOrigins": ["{EXTERNAL_ORIGIN}"],
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": false,
Expand Down

0 comments on commit dfa2ced

Please sign in to comment.