Implementation plan / Session plan / Handover RC-1-S16
Handover RC-1-S16 Build: Runtime decision services (part 1 of 2)¶
Card: RC-1-S16. Issue: cema-care/his#30. Branch: session/RC-1-S16. Slice: RC-1. Decision record: ADR-HIS-061.
What was built and where¶
The unit services/ess-runtime-decision, made from the service template with new-unit.sh ess-runtime-decision MOD-ESS-001 MOD-ESS-002 MOD-ESS-003:
- mod-ess-002 (the decision service, RC-1-S17) and mod-ess-003 (consent) are the template's empty modules;
- the unit's README.md lists the packages, the content files, the settings and what the realm his needs;
- the unit's kit takes RC-1-S05's and RC-1-S15's fixes (HisException field errors and status, PolicyEnforcer.requireFor, the missing query parameter as validation-failed, the lz4-java and snappy-java constraints);
- one kit change of its own, on behalf of a person (below).
No external dependency was added; every lockfile was written with ./gradlew dependencies --write-locks.
MOD-ESS-001 in mod-ess-001 serves all 35 operations of identity.v1 (IF-ESS-001) at their contract paths. It publishes IdentityChanged (EVT-ESS-001) on his.ess.identity.v1 through the outbox, with aggregate Identity (the account or the service identity), enterprise-scoped.
- Accounts (FR-ESS-IAM-001):
- one account per workforce identity: a second one is refused, and a person with a deactivated account is reactivated instead;
- the section 4.3 states, with a suspension from its effective time (kept pending until then);
- validity's end suspends, and 90 days of suspension deactivate (CFG-ESS-004);
- account IDs and sign-on names are never reissued;
- before and after values are audited; a manual change of a value the feed owns is audited as an override and marked for reconciliation;
- the messages of part 10 are answered as
validation-failedwith the field pointer; - the organizational unit and locations are checked active in MOD-ESS-005 (master-data.v1; an outage answers 503).
- The identity-source feed (
submitIdentitySourceEvent; parts 6.3 to 6.5, WF-ESS-001): - joiner, mover, leaver, credential and status events, idempotent per source and
sourceEventId(duplicate); - what cannot be applied is
quarantinedand kept; - a joiner gets the roles of its position's approved mapping (
identity/positions.json, synthetic); - a mover loses the mapped roles its new position does not give and opens a review of its assignments;
- a lapsed or restricted credential suspends the roles that need one, and they return when it is current;
- the feed heartbeat raises an operational alert after 26 hours of silence.
- MasterDataChanged of practitioners (RC-1-S07's follow-up for this module):
lapsedsets the account's credential status, so the credential-requiring roles are suspended;sip-expiredsuspends the credential-requiring roles scoped in that facility only (GAP-ESS-017);currentrestores them.- Authentication (FR-ESS-IAM-002). Sign-on, MFA, step-up and sessions are Keycloak's (token profile). The unit does what is its own (ADR-HIS-061 point 5):
- administrative unblock, factor reset and session revocation, each with its recorded identity verification or reason;
- the failed full sign-in count and the block, fed from Keycloak's sign-in events, each applied once; the block period ends by itself (CFG-ESS-002);
- the assurance rules of CFG-ESS-001;
- the session rules of CFG-ESS-003 (
api.SessionPolicy); - the badge path (
QuickFactor): badge, managed device, inside the hospital, six digits, three failures close the path without blocking, a full sign-in reopens it, uniform messages; the PIN verifier sits behind thePinVaultport of Domain 2; - second-person authorization in place (
SecondPerson). - Service identities (FR-ESS-IAM-003):
- the register: owner, workload, environment, scopes, rotation interval within 90 days (CFG-ISE-014), validity;
- display devices are read-only and limited to their boards;
- a scope change waits in
requestedScopesfor the security officer, and the requester never approves; - the daily check flags an overdue rotation and alerts the owner and the security officer;
- an ended validity suspends the identity;
- an owner leaving flags it and gives it to the fallback owner;
- misuse is audited as
ess.iam.service-identity-misuse, and an interactive sign-on attempt also raises an alert; - every event of the register carries
identityType: service. - Roles and recertification (FR-ESS-IAM-004):
- the starter role catalogue of D10-ESS 9.2 is version 1 (
identity/roles.json, 31 roles); - assignments carry scope and validity and are approved by the accountable approver of the approver directory;
- the subject never decides: 403
unauthorized, and the item is routed to another approver; - refused: a role-level segregation-of-duties conflict without an approved exception; a missing credential; a clinical role on an account that is not a named individual's; an ended validity; an unpublished role version; an inactive scope entity;
- a revocation acts at the next decision;
- campaigns list every in-scope approved assignment with its approver and give each approver a review task (MOD-ESS-008);
- at the due date an unreviewed privileged item is suspended, and any other is escalated and suspended 14 days later;
- the evidence lists every item with its decision or default action (REP-ESS-004).
- For the decision service (RC-1-S17),
care.cema.his.ess.mod001.api: SubjectAttributes: the subject; the session check (state, revocation, maximum lifetime); the roles in force at a facility, with privileged roles only foraal2; the assurance a request needs; the use check of a service identity; the last use of assignments; actor resolution;SegregationOfDuties: transaction-level rules onattributes.earlierActors, for example the prescriber verifying their own order is denied with rule 2;SessionPolicy.- Keycloak is kept in step through the request queue: a requests table written in the transaction of the change and sent after commit, in order per account or client, and retried. It also carries the tasks for MOD-ESS-008 and the alerts kept for MOD-ESS-007 (RC-2).
- A user is provisioned with the account ID as its ID, so the token subject is the account ID, and is enabled only while pending activation or active.
- Logout ends the refresh tokens on suspension and revocation.
- A service identity's client has client credentials only and a
submapper with its ID. - Cross-cutting duties:
- the policy decision before every action (
ess.iam.<record>.<verb>); - audit of every operation with the D10-ESS 9.5 types
ess.iam.account,sign-in,block,session,factor,second-person,service-identity,service-identity-misuseandrole, with no credential or PIN ever written; - Idempotency-Key replay, ETag with If-Match;
- correlation and telemetry from the kit.
- Kit change, on behalf of a person (FR-ESS-IAM-003 part 6.6, AC-04): a person's token issued to a client that is not a user application (
his.security.user-clients) gives an actor withvia. Audit then carries bothactorHumanandactorService.TestTokens.withClaimssigns tokens with any claims of the token profile. - Migration
V1__identity_and_access.sql(schemamod_ess_001): a partial unique index keeps one non-deactivated account per workforce identity.
ADR-HIS-061 and its row in the decision record index (58 records). ADR-HIS-057, 059 and 060 are taken by the open pull requests of RC-1-S09 and RC-1-S18, so this record is 061.
Checks and their result¶
The integration environment ran as HIS_SESSION=RC-1-S16 (his-rc-1-s16): light profile first, then full for the Keycloak test. Node.js is not on this server, so the contract tools ran in node:22.18-bookworm through the test's own runner.
| Check | Command | Result |
|---|---|---|
| Build and every test of the unit | ./gradlew build in services/ess-runtime-decision |
passed. On the full profile 121 tests: MOD-ESS-001 89, kit 27 (the Kafka adapter test skipped), app 3, MOD-ESS-002 1, MOD-ESS-003 1. On the light profile, as the pipeline runs it, the 3 Keycloak adapter tests do not run either, as the Kafka adapter test does not: 117 run, all pass |
| Provider contract test | ./gradlew :mod-ess-001:test --tests '*IdentityContractTest' |
passed: all 35 operations of identity.v1 pass his-contract verify contracts/ess, 92 cases (documented request, no credential, broken body). The IdentityChanged events published during them (22) pass his-contract validate-event |
| Identity provider adapter on Keycloak 26 (full profile) | ./gradlew :mod-ess-001:test --tests '*KeycloakIdentityProviderTest' |
passed, 3 tests: subject = account ID, logout ends refresh, a disabled user cannot sign in, the sign-in event is read, a service identity's token has its ID as subject and its client refuses the password flow |
| Dependency scan and SBOM | platform/delivery-pipeline/bin/dependency-scan services/ess-runtime-decision |
0 blocking (6 medium) |
| Image scan | platform/delivery-pipeline/bin/image-scan services/ess-runtime-decision |
0 blocking (15 low, 116 medium) |
| Static analysis | platform/delivery-pipeline/bin/static-analysis services/ess-runtime-decision |
no blocking finding |
| Secret scan | platform/delivery-pipeline/bin/secret-scan code origin/main HEAD, and docs |
no secret; no exception file added |
| Documentation | check_links.py; mkdocs build |
0 broken links; the site builds |
All operations of identity.v1 are enterprise-scoped (x-his-facility: enterprise), so verify has no facility cases. The facility rule of this module is the scope of an assignment, covered by RoleAdministrationTest.ac01FacilityScope.
Requirements and test scenarios¶
Tests are in services/ess-runtime-decision/mod-ess-001/src/test/java/care/cema/his/ess/mod001/. Each class carries @Tag with its requirement and scenario, and every display name starts with them.
| Requirement, criterion | Test |
|---|---|
| FR-ESS-IAM-001 AC-01 joiner processed and approved: one Active account linked to the workforce identifier | AccountLifecycleTest.ac01Joiner |
| FR-ESS-IAM-001 AC-02 second account for the same identifier refused; PR-IAM-001-1 | AccountLifecycleTest.ac02SecondAccountRefused |
| FR-ESS-IAM-001 AC-03 leaver with open sessions: Suspended, next request on any session denied; PR-IAM-001-3; part 6.4 | AccountLifecycleTest.ac03LeaverWithOpenSession, leaverFromEffectiveTime |
| FR-ESS-IAM-001 AC-04 clinical role on an unlinked account refused; BR-ESS-002 | AccountLifecycleTest.ac04ClinicalRoleOnUnlinkedAccount |
| FR-ESS-IAM-001 AC-05 every access log entry resolves to one human or one service identity | AccountLifecycleTest.ac05ActorResolves; KeycloakIdentityProviderTest.userLifecycle (subject = account ID) |
| FR-ESS-IAM-001 PR-IAM-001-2, PR-IAM-001-4, parts 3, 6.5, 6.7, 10, 12; BR-ESS-003; CFG-ESS-004 | repeatedSourceEvent, validToReached, ownAccount, mover, deactivatedNotDeleted, validationMessages, manualOverride, credentialLapse, credentialingRecord, identityProviderInStep |
| FR-ESS-IAM-002 AC-01 privileged role not in a session without MFA; PR-IAM-002-1 | AuthenticationTest.ac01PrivilegedNeedsMfa |
| FR-ESS-IAM-002 AC-02 each protected path without second factor refused; BR-ESS-007, CFG-ESS-001 | AuthenticationTest.ac02ProtectedPaths |
| FR-ESS-IAM-002 AC-03 high-impact action needs step-up; PR-IAM-002-3 | AuthenticationTest.ac03StepUp |
| FR-ESS-IAM-002 AC-04 threshold of failed sign-ins: Blocked, audited, unblocked at the end of the period; PR-IAM-002-2; part 6.5 | AuthenticationTest.ac04Block, verifiedUnblock; KeycloakIdentityProviderTest.signInEvents |
| FR-ESS-IAM-002 AC-05 suspended account's token denied | AuthenticationTest.ac05SuspendedToken, revokeSessions; KeycloakIdentityProviderTest.userLifecycle |
| FR-ESS-IAM-002 AC-06 inactivity: lock after 10 minutes on a desktop and 5 on a handheld, session kept; PR-IAM-002-5 | AuthenticationTest.ac06Inactivity (the lock screen itself is UI-ESS-001's, below) |
| FR-ESS-IAM-002 AC-07 warning 10 minutes before the maximum lifetime; session ends at it; PR-IAM-002-6 | AuthenticationTest.ac07MaximumLifetime |
| FR-ESS-IAM-002 AC-08 three failed PINs close the badge path, the account is not Blocked, a full sign-in reopens it; PR-IAM-002-7 | AuthenticationTest.ac08ThreeFailedPins |
| FR-ESS-IAM-002 AC-09 PIN without the badge or from a remote origin refused; PR-IAM-002-8, PR-IAM-002-4 | AuthenticationTest.ac09PinRefused |
| FR-ESS-IAM-002 AC-10 requester as second person refused; a different user's authorization records both names and roles; PR-IAM-002-9 | AuthenticationTest.ac10SecondPerson |
| FR-ESS-IAM-002 parts 6.10, 13 | pinSetOnlyAfterFullSignIn, factorReset |
| FR-ESS-IAM-003 AC-01 out-of-scope action denied and audited; PR-IAM-003-1; part 6.4 | ServiceIdentityTest.ac01OutOfScope |
| FR-ESS-IAM-003 AC-02 interactive sign-on refused, security alert | ServiceIdentityTest.ac02InteractiveSignOn; KeycloakIdentityProviderTest.serviceClient |
| FR-ESS-IAM-003 AC-03 overdue rotation at the daily check: owner and security officer notified, overdue on the register; PR-IAM-003-2 | ServiceIdentityTest.ac03OverdueRotation |
| FR-ESS-IAM-003 AC-04 on behalf of a user: both identities in audit; part 6.6 | ServiceIdentityTest.ac04OnBehalfOf |
| FR-ESS-IAM-003 AC-05 display: unconfigured board or write denied and audited, no user session; PR-IAM-003-4; part 6.9 | ServiceIdentityTest.ac05WallDisplay |
| FR-ESS-IAM-003 PR-IAM-003-3, parts 5, 6.5, 6.7, 6.8, 10, 11, 13; BR-ESS-004 | registrationRules, scopeChangeNeedsApproval, ownerInactive, suspendRetireExpire |
| FR-ESS-IAM-004 AC-01 facility-scoped role does not contribute at another facility | RoleAdministrationTest.ac01FacilityScope |
| FR-ESS-IAM-004 AC-02 assignment revoked in a campaign stops working; PR-IAM-004-3 | RoleAdministrationTest.ac02RevokedInCampaign, revocationAtOnce |
| FR-ESS-IAM-004 AC-03 campaign evidence: every item has a reviewer decision or a default action | RoleAdministrationTest.ac03Evidence |
| FR-ESS-IAM-004 AC-04 segregation-of-duties conflict refused unless an approved exception; PR-IAM-004-1 | RoleAdministrationTest.ac04RoleConflict |
| FR-ESS-IAM-004 AC-05 privileged assignment unreviewed at the due date: suspended, default action in the evidence; PR-IAM-004-4 | RoleAdministrationTest.ac05PrivilegedUnreviewed |
| FR-ESS-IAM-004 AC-06 prescriber verifying own order: Deny with the segregation-of-duties reason | RoleAdministrationTest.ac06PrescriberVerifies |
| FR-ESS-IAM-004 PR-IAM-004-2, BR-ESS-006, parts 6.1, 6.6, 6.8, 10 | selfApprovalRouted, requestRules, catalogue, revocationAtOnce |
| IF-ESS-001, EVT-ESS-001 | contract/IdentityContractTest |
Scenarios: TEST-ESS-001 is AccountLifecycleTest, TEST-ESS-002 AuthenticationTest, TEST-ESS-003 ServiceIdentityTest, TEST-ESS-004 RoleAdministrationTest. All pass.
Non-functional targets designed for:
- NFR-ESS-007 Security:
- a policy decision on every operation;
- revocations act at the next decision;
- privileged roles need aal2;
- no credential, PIN or factor material in the register or in audit;
- people only, never a service, approve, decide and retire;
- every Keycloak change is sent after commit and retried.
- NFR-ESS-011 Interoperability: every operation passes his-contract verify, and IdentityChanged passes validate-event.
- NFR-ESS-015 Time integrity: UTC to the millisecond throughout, and effective times are kept (a leaver from its time, validity ends, block periods).
- NFR-ESS-016 Localization: messages are the specification's English wording, which UI-ESS-002 shows. Names are FHIR HumanName, and a joiner's sign-on name is folded to ASCII from the Indonesian name.
- NFR-ESS-017 Observability: logs with correlation, the request queue's state and attempts, and traces from the kit.
Done differently from the specification or contract, and why¶
- Parts of FR-ESS-IAM-002 are not this unit's to show. The specification decides; this unit does its part, and the rest belongs to the units named:
- the lock screen showing no patient data and keeping drafts (AC-06), the user switch and the expiry warning on screen (AC-07) are the shared component UI-ESS-001 (RC-1-S23). This unit holds and answers their values (
SessionPolicy) and keeps inactivity from ending a session; - sign-on with MFA itself is Keycloak's (IF-ESS-002).
- The badge PIN and second-person authorization have no interface. IF-ESS-002 is a token profile only, and Keycloak has no badge-PIN authenticator. Both are module services, built and tested here (AC-08, AC-09, AC-10). Their surface needs three things, recorded as follow-ups:
- a contract addition (ESS contract session);
- a Keycloak authenticator that calls the badge check;
- the PIN vault of Domain 2.
Until they exist the vault is detached, so no PIN matches and the badge path fails closed: users sign in fully.
- The decision itself is RC-1-S17's. FR-ESS-IAM-002 AC-01 to AC-03 and FR-ESS-IAM-004 AC-01, AC-02 and AC-06 speak of permits and denials. They are tested on the attributes and rules the decision service decides on: roles in force at a facility, privileged roles only for aal2, the assurance a request needs, the segregation-of-duties check. The permit or deny is RC-1-S17's, on these.
- A block does not end open sessions. Part 6.7 ends a session at its maximum lifetime, on sign-out or on revocation (by suspension or by an administrator); a block is not among them. A block stops new sign-ins only. The decision service lets the open sessions of a blocked account go on.
- Keycloak's realm settings are not yet applied by the unit. ADR-HIS-061 lists what the realm needs (administration client, events, no brute-force detection, no required e-mail, 12-hour sessions). The adapter test sets them on its own realm. The development realm platform/dev-environment/config/keycloak/his-realm.json is FN-S02's (follow-up).
- The administration client holds manage-realm because partial import needs it, and partial import is what keeps the account ID as the token subject. A narrower mapper is left to the security review (ADR-HIS-061).
- Approvers come from a directory (ADR-HIS-061 point 6): per unit, its approvers in order and a fallback approver who also stands in as the approver's manager. The specification names the approver per organizational unit and a fallback approver, but no source. The directory names real people, so it has no seed and is set per deployment. A request with no approver configured is refused.
- Permission sets of the starter roles hold Domain 10's own resources and the ADM resources of RC-1. The specification makes each role's permissions "the union of the rows in section 9.2 of each domain specification"; each domain adds its own rows as a new role version through the configuration lifecycle (item type ess.role, follow-up for the governance unit).
- clinicalAccess of the starter roles is set for the health professions and students (physician, nurse and midwife, allied health, student, pharmacist, pharmacy technician, specimen collector, laboratory, imaging). The catalogue has no such column; the contract has the field. Question Q1.
- The segregation-of-duties rule 3 at role level (the cashier and refund approver roles not held for the same cash point) is not built: the starter catalogue has no refund approver role and no cash-point scope. Its transaction-level part is.
- The contract was not changed. Self-approval answers 403 and routes, as CONTRACT-POINTS says.
Questions for a person¶
None blocks this session. Each takes the reading above and is listed under "Needs a person" in the pull request.
| # | Question | Owner | What the unit does now |
|---|---|---|---|
| Q1 | BR-ESS-002: every account has one workforce identifier by contract, so when is an account "not linked to exactly one workforce identity"? And which starter roles grant clinical access? | Owner of D10-ESS, Security and Privacy Office | Linked means one workforce identifier that no other account shares and, for a role with clinical access, a link to the person's practitioner record (FR-ESS-IAM-001 part 4). Clinical access is set for the health professions and students. This refuses more, never less (ADR-HIS-061 point 7) |
Follow-ups outside the card¶
- RC-1-S17 (decision service,
mod-ess-002): - decide on
api.SubjectAttributes: session check first, thenrolesAt(subject, facility, acr), thenSegregationOfDutieswithattributes.earlierActors; - drop cached decisions on IdentityChanged;
- register the rules for the actions and attributes of ADR-HIS-061 point 8 (
self,routedApprover,privileged,securityHold; step-up on privileged administration); - register the identity steward, workflow and other roles of the RC-1 handovers;
- call
used(...)with the assignments a permit relied on. - ESS contract session:
identity.v1operations for the badge check (called by a Keycloak authenticator), for setting a PIN and binding the badge, and for the in-place second-person decision (CUX-64; also RC-1-S15'ssecondPersonfollow-up);- an approver directory operation, or a configuration item type for it.
- Domain 2:
- the PIN vault (OpenBao), behind
PinVault; - a Keycloak badge-and-PIN authenticator for managed devices;
- the realm settings of ADR-HIS-061 in every environment.
- FN-S02 (
platform/dev-environment): the development realmhisneeds the settings of ADR-HIS-061 for this unit to run against it: an administration client foress-runtime-decision, LOGIN and LOGIN_ERROR events, a user profile without a required e-mail, a 12-hour session maximum. RC-1-S03's follow-ups (MFA claimsamr,acr; adev.stewarduser) also stand. - Coordination unit (
services/ess-coordination): register the task typesess.access-request-approvalandess.recertification-review. Until then the unit's task requests stay pending and are retried. - Governance unit (
services/ess-governance): the configuration item typesess.role(role versions),ess.position-role-mappingandess.sod-exception. This unit then installs them from ConfigurationChanged; it installs only its seed now. - RC-2 (MOD-ESS-007): take over the alerts kept in
outbound_request(kindnotification): rotation overdue, service identity misuse, feed silent. - Service template: the kit's on-behalf-of actor (
Actor.via,his.security.user-clients) andTestTokens.withClaims, made in this unit's copy. - RC-1-S26 (integrate): add
ess-runtime-decisiontoe2e/scenarios/RC-1/stack.jsonwith its Keycloak administration client,registries-urlandworkflow-url. - Design system (RC-1-S21): none from this session.