Closes #132.
Staff logins (behandel + beheer portals) now need a second factor; the citizen realms are unchanged.
**How:** every seeded medewerker carries a TOTP credential, which activates Keycloak's stock *conditional OTP* step in both the browser flow and the direct grant — no custom browser-flow JSON in the export. `CONFIGURE_TOTP` is a default required action so a medewerker added later must enrol first. ADR-0031 records the choice and, explicitly, that the shared fixture secret is a demo posture only.
**Tests (red first, 30c5279):**
- `check_realms.py` asserts the medewerker password-only grant is **refused**, then that password + TOTP succeeds and still carries the `behandelaar` role. It failed with `[MFA NOT ENFORCED]` against the old export.
- The three medewerker e2e logins move to `loginMedewerker()` (`tests/e2e/medewerker-login.ts`), which submits Keycloak's OTP prompt. Both TOTP implementations (Python `hmac`, Node `crypto`) are ~6 lines of RFC 6238 — no new dependency.
Verified locally against Keycloak 26.1: password-only → `invalid_grant`, password + code → 200, and the browser flow's `#otp` prompt accepts a computed code and issues an auth code.
## Definition of Done
- [x] Failing test/verify committed first; implementation makes it pass.
- [x] Conventional Commits referencing the issue (`refs #132`).
- [ ] CI green (verify-stack compose smoke + relevant checks).
- [x] `docker compose up` reaches green health within 3 minutes (Keycloak change is import-time only).
- [x] Docs touched (runbook, synthetic-data, demo-script) + ADR-0031 + demo note.
- [x] Closed by the merging PR (`closes #132`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)Reviewed-on: #158
22 lines
1.2 KiB
TypeScript
22 lines
1.2 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { loginMedewerker } from './medewerker-login';
|
|
|
|
// S-15a walking skeleton: a beheerder logs in to the beheer portal (medewerker realm) and sees the
|
|
// read-only ZTC catalogus. The verify stack seeds and publishes the BIG-REGISTRATIE zaaktype (the
|
|
// same one verify-domain relies on), so it must appear in the catalogus. Runs against the shared
|
|
// verify stack, so it asserts on that stable seeded zaaktype rather than anything test-specific.
|
|
test('a beheerder sees the published zaaktypen in the catalogus', async ({ page }) => {
|
|
await page.goto('http://beheer/');
|
|
|
|
// The beheer portal redirects to the Keycloak medewerker realm login (same realm as behandel),
|
|
// which enforces MFA: password, then a TOTP code.
|
|
await loginMedewerker(page, 'bram-beheerder');
|
|
|
|
await expect(page.getByRole('heading', { name: /Catalogus/i })).toBeVisible();
|
|
|
|
// The seeded, published BIG zaaktype is shown by its business identificatie. Match the cell
|
|
// exactly (case-sensitive): getByText is case-insensitive, so it would also match the omschrijving
|
|
// cell "BIG-registratie" and trip strict mode.
|
|
await expect(page.getByRole('cell', { name: 'BIG-REGISTRATIE', exact: true })).toBeVisible();
|
|
});
|