mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-18 00:24:15 +00:00
Auto-provision one OpenLDAP group per role declared under each application's `rbac.roles` in `config/main.yml`, gated on `group_names` so only apps deployed on the host contribute. Keycloak syncs the groups from LDAP, emits the `groups` claim via the shared RBAC client scope, and WordPress maps that claim to a local role in a mu-plugin (auto-loaded, cannot be deactivated from the admin UI). No direct LDAP bind from WordPress. Non-obvious design choice: the `groups` client scope MUST be a *default* client scope, not optional. When optional + `include.in.token.scope=false`, Keycloak 26 drops the group-membership mapper from userinfo even when the scope is explicitly requested, so the mu-plugin receives no `groups` and falls back to `subscriber` for every user. ID/access tokens still carry the claim, but WP consumes userinfo. Playwright verifies the three-role cycle (subscriber/editor/administrator) serially and idempotently per requirement 004: the add step runs via the Keycloak admin UI (detects "already a member" via a disabled picker checkbox and skips); teardown runs via the Keycloak Admin REST API. Only memberships the test itself added are removed, so any pre-existing membership is preserved. Each hop (super-admin, biber, WP-admin) runs in its own browser context so WP session cookies and Keycloak SSO cookies cannot leak. Resolves: docs/requirements/004-generic-rbac-ldap-auto-provisioning.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>