Extract init logic to versioned sync script + bootstrap admin user
- Move the inline keycloak-init bash block out of docker-compose.yml into init/sync.sh, mounted into the init container at /opt/init. The script is fully idempotent and is the new entry point for any future role/group/user/realm configuration changes — re-run with `docker compose up -d keycloak-init --force-recreate`. - Add reusable helper functions (ensure_user, ensure_group, ensure_user_in_group, ensure_user_realm_role, ensure_user_client_role) on top of kcadm.sh, with safe parsing of user/group IDs. - Bootstrap admin identity jovann@siteconseil.fr (password Shoko1997@) in both realms: * master realm: granted the global `admin` role. * ecosplay realm: granted realm-management/realm-admin and added to groups super_admin_asso and superadmin. Both users have CONFIGURE_TOTP as a required action so OTP enrollment is forced at first login. - Mirror the ecosplay user in the realm import JSON for fresh installs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,29 @@
|
||||
{ "name": "superadmin" }
|
||||
],
|
||||
|
||||
"users": [
|
||||
{
|
||||
"username": "jovann@siteconseil.fr",
|
||||
"email": "jovann@siteconseil.fr",
|
||||
"firstName": "Jovann",
|
||||
"lastName": "SiteConseil",
|
||||
"enabled": true,
|
||||
"emailVerified": true,
|
||||
"credentials": [
|
||||
{
|
||||
"type": "password",
|
||||
"value": "Shoko1997@",
|
||||
"temporary": false
|
||||
}
|
||||
],
|
||||
"requiredActions": ["CONFIGURE_TOTP"],
|
||||
"groups": ["/super_admin_asso", "/superadmin"],
|
||||
"clientRoles": {
|
||||
"realm-management": ["realm-admin"]
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"clients": [
|
||||
{
|
||||
"clientId": "ecosplay-web",
|
||||
|
||||
Reference in New Issue
Block a user