Skip to content

Architecture / Decision records / ADR-HIS-061

ADR-HIS-061 Identity and access: the account register beside Keycloak, subject attributes for the decision service, approvers, and the authentication rules the unit owns

Status Accepted
Decided 2026-11-25 by session RC-1-S16
Record Drafted 2026-11-25; approved 2026-11-30 by the Enterprise Architecture Board
Where the rule lives services/ess-runtime-decision/ (its README.md; module mod-ess-001, its migration mod-ess-001/src/main/resources/db/mod_ess_001/, identity/roles.json, identity/positions.json, identity/transaction-rules.json, the api package, the contract test in mod-ess-001/src/test/java/care/cema/his/ess/mod001/contract/)

Context

Session RC-1-S16 makes the runtime decision unit services/ess-runtime-decision and builds its first module, MOD-ESS-001 Enterprise Identity and Access Management: - FR-ESS-IAM-001: accounts and their lifecycle; - FR-ESS-IAM-002: authentication and MFA; - FR-ESS-IAM-003: service identities; - FR-ESS-IAM-004: roles, segregation of duties and recertification.

It serves identity.v1 (IF-ESS-001) and publishes IdentityChanged (EVT-ESS-001), the contracts of ADR-HIS-048. That record makes IF-ESS-002 OpenID Connect on Keycloak, and keeps roles and permitted facilities out of the token, so that the decision service holds them (DEC-ESS-008).

RC-1-S17 builds the decision service (MOD-ESS-002) in the same unit, on what this module offers. Every domain asks that service, so the choices below bind it and every enforcement point. The specification and contracts leave these points to the design: - how the account register and Keycloak stay in step; - how a revocation acts before a token expires; - which parts of authentication this unit decides, when sign-on itself is Keycloak's; - who the "accountable approver" is; - how transaction-level segregation of duties reaches a decision; - what "an account not linked to exactly one workforce identity" means when every account has a workforce identifier.

Decision

  1. The unit and its modules. services/ess-runtime-decision is made from the service template with MOD-ESS-001, MOD-ESS-002 and MOD-ESS-003 (new-unit.sh). MOD-ESS-001 is built here; MOD-ESS-002 and MOD-ESS-003 are the template's empty modules until their sessions. MOD-ESS-002 uses MOD-ESS-001 only through care.cema.his.ess.mod001.api (the unit's module boundary test). The unit's kit takes the fixes of RC-1-S05 and RC-1-S15: HisException with field errors and status, PolicyEnforcer.requireFor, the missing query parameter as validation-failed, and the lz4-java and snappy-java constraints.

  2. The register is the system of record; Keycloak follows it. Accounts and service identities live in MOD-ESS-001's schema; Keycloak (realm his) runs sign-on, MFA, step-up and sessions.

  3. Every change the provider must know is written in the transaction of the change as a request of the module (outbound_request, kind idp). It is sent after commit, in order per account or client, and retried. A refused command reaches the provider never, a committed one always.
  4. A user is created by partial import, with the account ID as its ID, so the token's sub is the account ID (token profile, FR-ESS-IAM-001 AC-05). A user is enabled while the account is pending activation (for enrolment) or active, and disabled otherwise.
  5. A service identity gets a confidential client with client credentials only: no browser, password or implicit flow, so no interactive sign-on (FR-ESS-IAM-003 part 6.2). A hardcoded sub mapper gives its tokens the service identity ID. The client is enabled from approval until suspension or retirement.
  6. The unit's administration client holds the realm-management roles manage-users, manage-clients, view-events and manage-realm (manage-realm is what partial import needs).
  7. The realm's user profile must not require an e-mail, which DE-ESS-001 does not hold.
  8. Credentials, PINs and factor material are never in the register (SEC-009, DEC-ESS-007).
  9. Without a configured provider (light profile) the provider adapter is detached: it logs and sends nothing.

  10. A revocation acts at the next decision, not at token expiry. The module keeps, per account, the time its sessions were last revoked (suspension, deactivation, revokeAccountSessions). SubjectAttributes.session refuses a token issued at or before it. It also refuses an account that is not active or blocked, and a session past its maximum lifetime counted from auth_time (12 hours, CFG-ESS-003). Keycloak's logout ends the refresh tokens; the decision service ends the access tokens already issued. A block stops new sign-ins only: open sessions go on, so failed sign-ins by someone else never end a clinician's work.

  11. Subject attributes for the decision service (api.SubjectAttributes, DEC-ESS-008):

  12. who a subject is (account or service identity, state, unit, locations, credential status; scopes, environment and boards of a service identity);
  13. the session check of point 3;
  14. the roles in force at a facility: approved, in validity, with enterprise scope or a scope that lies in that facility. A department or location scope lies in the facility the registry gives it (AC-01). A privileged role contributes only to an aal2 session (PR-IAM-002-1, AC-01);
  15. the assurance a request needs, from CFG-ESS-001: a privileged role, a remote origin or no stated zone, an unmanaged device, the first sign-in after a block or factor reset, a change of one's own factor or PIN, an administration console, a high-impact action. The answer is aal2 with step-up when the session is aal1;
  16. the use check of a service identity: active, its own environment, in scope, a display reading only its boards and never writing. A refusal is audited as ess.iam.service-identity-misuse;
  17. the last use of assignments, and the resolution of an actor ID to one person or one service.

They are read from the module's tables at each call. A cache in MOD-ESS-002 is dropped on IdentityChanged.

  1. What of authentication this unit decides.
  2. The failed full sign-in count and the block (CFG-ESS-002) are the module's, fed from Keycloak's LOGIN and LOGIN_ERROR events, each applied once. Keycloak's brute-force detection stays off: a module-owned count never counts failed PINs, and the block, its audit and the automatic unblock follow section 4.3.
  3. The badge path (badge registered, managed device, inside the hospital, three failed PINs close the path, a full sign-in reopens it, uniform messages) is the module service QuickFactor. The PIN verifier is behind the port PinVault (Domain 2). Without a vault it fails closed.
  4. Second-person authorization (SecondPerson) checks that the second person is a different, active user, stepped up in place within 2 minutes and holding the named role at the facility. A refusal needs a reason, and both names and roles are recorded.
  5. The CFG-ESS-003 values (screen lock by device class, warning, maximum lifetime) are api.SessionPolicy, for the shared sign-on component.
  6. The screen lock itself is UI-ESS-001's.

  7. Approvers. The accountable approver comes from an approver directory (approver_directory): per organizational unit, its approvers in order and a fallback approver, with the enterprise row *.

  8. The subject is never their own approver: the next approver, or the fallback, is chosen (BR-ESS-006).
  9. An inactive approver is skipped (WF-ESS-008).
  10. An escalation goes to the fallback approver of the approver's unit, who stands in as the approver's manager.
  11. The directory names real people, so it has no seed: it is set per deployment.
  12. A request with no approver configured is refused. The decision service still decides whether the chosen person may approve.
  13. A decision by the subject answers 403 unauthorized and routes the item to another approver, in a transaction of its own (contracts/ess CONTRACT-POINTS).

  14. "A named individual's account" (BR-ESS-002). Every account has one workforce identifier, unique among accounts that are not deactivated. A role with clinicalAccess also needs the account to link to the person's practitioner record, as FR-ESS-IAM-001 part 4 requires for clinical roles. Without it, the assignment is refused with "Clinical roles require a named individual account." This reading refuses more, never less.

  15. Segregation of duties, the catalogue and the policy actions.

  16. The starter role catalogue of D10-ESS 9.2 is version 1 of the role configuration items (identity/roles.json), with its privileged flag, credential requirement, recertification cycle and clinicalAccess for the health professions. Permission sets hold D10's own resources and RC-1's ADM resources; each domain adds its own as a new role version through the configuration lifecycle.
  17. The role-level rule 4 conflicts are listed with the catalogue. An approved exception (Security and Privacy Office, at most 12 months) covers one account, rule and pair of roles.
  18. Transaction-level rules (identity/transaction-rules.json) are answered through api.SegregationOfDuties. The calling domain sends the earlier actors of the item in the decision request's attributes.earlierActors as {role in the item: account ID}, for example {"prescriber": "<id>"} for rule 2. A subject who is an earlier actor that a rule names for the action's verb is denied, with the rule as the reason (AC-06).
  19. The module's own policy actions are ess.iam.<record>.<verb> on ess.WorkforceAccount, ess.Role, ess.RoleAssignment, ess.ServiceIdentity, ess.RecertificationCampaign and ess.IdentitySourceEvent. The attributes are self, routedApprover, privileged and roleId; a privileged role's administration is where the policy asks for step-up.

  20. On behalf of a person. A person's token issued to a client that is not a user application (his.security.user-clients, by default his-web, his-test) is a service acting for that person. The kit's actor carries the client as via, and audit carries both actorHuman and actorService (FR-ESS-IAM-003 part 6.6, AC-04). This is a change in this unit's copy of the kit; the template takes it in a session whose card covers it.

  21. Recertification and the feed.

    • At the due date (30 days) an unreviewed privileged item suspends its assignment; any other item is escalated, and suspended 14 days later (CFG-ESS-005).
    • A mover's change of unit opens a review of the account's assignments.
    • Review and approval tasks go to MOD-ESS-008 as ess.recertification-review and ess.access-request-approval, through the request queue of point 2. Alerts are kept for MOD-ESS-007 (RC-2).
    • The identity-source feed is idempotent per source and event identifier. A refusal is kept as quarantined, never dropped. A joiner of a person with a deactivated account waits for reactivation (pending-approval).
    • A joiner's sign-on name is derived from the name (given.family) and never reissued.
    • MasterDataChanged of a practitioner (lapsed, sip-expired with its facility, current) suspends or restores the credential-requiring roles, at that facility only for a SIP (BR-ESS-003, GAP-ESS-017).

Consequences

  • RC-1-S17 builds the decision on api.SubjectAttributes and api.SegregationOfDuties. Every decision first passes the session check, then uses rolesAt for the facility and the session's acr, then the transaction rules with the request's attributes.earlierActors. Domain sessions that need rule 2, 3, 5, 6, 7 or 8 send the earlier actors under the names of transaction-rules.json.
  • The realm his of every environment needs:
  • the unit's administration client with the roles of point 2;
  • sign-in events (LOGIN, LOGIN_ERROR) kept;
  • brute-force detection off;
  • a user profile that does not require an e-mail;
  • a session maximum of 12 hours, with an idle timeout no shorter.

The development realm of platform/dev-environment has none of these yet; the adapter test sets them on its own realm (follow-up). - Task types ess.recertification-review and ess.access-request-approval must be registered in the coordination unit; until then their creation is retried. - A narrower alternative to manage-realm is a realm-wide mapper from a user attribute to sub. It is left to the security review, because overriding sub by a mapper depends on the Keycloak version. - The PIN vault of Domain 2, the provider's badge authenticator and the in-place authorization dialog have no interface yet. The module services are built and tested; their surface is a contract follow-up.

Alternatives considered

  • Roles and facilities as token claims, refreshed at re-login. Refused by DEC-ESS-008 and AC-02 of FR-ESS-IAM-004: a revocation must act before the token expires.
  • Keycloak as the system of record for accounts, with the register reading it. Refused: the account lifecycle of section 4.3, the feed's idempotency, the audit with before and after values, and service identity metadata are the register's (DEC-ESS-007). Keycloak has no place for them.
  • Keycloak's brute-force detection for the block. Refused: it would also count a future badge-PIN authenticator's failures, which must not block the account (PR-IAM-002-7). The block, its audit and IdentityChanged would happen outside the register.
  • Approvers by permission (whoever holds ess.RoleAssignment:approve in scope). Refused for now: the starter catalogue has no access approver role, and the specification names the approver per organizational unit. Permission is still checked by the decision service.