Security and operations

Authentication and Access-Control Matrix

Check which authentication methods, roles, patient relationships, and permissions apply to each type of access.

Production rule. Authentication proves who the caller is. Patient data is returned only when every applicable tenant, role, route, relationship, consent, classification, purpose, resource and release control permits the operation.

This matrix is cumulative. An allow at one layer never overrides a deny at a later layer. A super_admin role, SMART wildcard, broad Keycloak group or API key does not silently bypass tenant isolation, protected-record policy, patient consent or audit.

Authorization Decision Flow

Every governed request follows the same decision path
AuthenticateIssuer, signature, audience, expiry, credential state
->
Resolve contextTenant, organisation, environment, facility
->
Authorize actionRole, route, method, SMART/API scope
->
Resolve patientEHR, FHIR, composition and document to MPI
Patient relationshipSelf, service, care team, admin or system
->
Privacy controlsConsent, opt-out and selected members
->
Resource controlsProtected class, template, query, release, export
->
Audit and respondReturn only the permitted representation

If any step denies the request, processing stops. Patient aliases and persisted FHIR identifiers are resolved to the authoritative MPI patient before the relationship decision is made.

Patient Access Levels

Each level describes the caller’s relationship to one patient for one request. Administrative and system access have separate rules. Emergency access is temporary and requires its own approval and review.

LevelRuntime scopeWho qualifiesPermitted boundaryExplicit exclusion
L0deniedUnauthenticated, invalid context, or no qualifying relationshipExplicitly public readiness and discovery routes onlyPatient discovery, clinical data and protected-patient existence leakage
L1Authenticated, no patient relationshipValid staff/app identity with a route roleGranted non-patient control-plane or catalogue functionsPatient records merely because a route or workspace can be opened
L2selfPatient Portal user or validated proxy representing the patientReleased patient-facing information for exactly the represented patientUnreleased clinician-only content, another patient and staff administration
L3serviceClinician assigned to a governed service actively related to the patientCare demographics, matching service records, and medication/allergy safety dataFull longitudinal record, unrelated services, cohorts and unfiltered AQL
L4longitudinalActive explicit patient care-team memberClinically necessary cross-service informationOpted-out membership, protected data without clearance, population reporting
L5administrativeGoverned super_admin or system_admin operationExplicit administrative workflows within tenant contextAutomatic clinical need-to-know or bypass of consent, protection and audit
L6systemRegistered service with explicit trusted-system scopeExact tenant-bound machine operation and resource contractHuman use, cross-tenant access, undeclared resources and secondary use
E1Emergency overlayEligible clinician, break-glass clearance, emergency purpose and reasonTime-limited access necessary for the emergencyPermanent access, silent routine browsing, bulk export and omitted review

The response header X-AMCDR-Clinical-Access-Scope reports the server-resolved scope on governed clinical responses. It is diagnostic evidence, not a client-side authorization mechanism.

Authentication Matrix

Credential or flowActorRequired validationResolved contextProduction restriction
Keycloak/OIDC code + PKCEInteractive staffIssuer, signature, audience, expiry, state/nonce and PKCEAMCDR user, memberships, normalized roles and tenant contextRealm role alone does not create a patient relationship
Local passwordStaff where OIDC is absentPassword policy, active account and token invalidation after password changeLocal user, memberships and rolesDisabled when Keycloak/OIDC is authoritative; no shared accounts
SMART code + PKCEFirst- or third-party applicationRegistered client, exact redirect URI, audience, PKCE, launch context and scopesUser/app plus patient, encounter and SMART grantsSMART grants constrain access and never override AMCDR policy
Patient Portal SMART sessionPatient or authorized proxyPatient link, active delegation, represented patient and release policyL2 self for one patientPatient and workforce assignment groups remain separate
API keyIntegration or automationHashed lookup, active state, tenant binding, scopes, expiry and revocationRegistered service/user and explicit scopesOne credential per integration; never reuse a human administrator
Trusted system tokenApproved internal/national serviceNormal token checks plus explicit trusted-system scopeL6 system inside signed tenant contextTrust is never inferred from network location

Interactive workspace and Patient Portal sessions expire after 900 seconds of inactivity. Keyboard, pointer, touch, focus and activity in another AMCDR tab on the same origin reset the timer. Background refresh does not. Timeout revokes the bearer session, clears patient context, ends the Keycloak session, and requires a new sign-in. The default bearer-token lifetime is also 900 seconds, and expired bearer tokens cannot be refreshed.

Fine-Grained Patient Data Matrix

Conditional means the named workflow, role, release or clearance must also permit the action. Every column remains tenant-bound and audited.

Data or actionL2 self/proxyL3 serviceL4 care teamL5 adminL6 system
Identity and care demographicsOwn/represented patientMinimum needed for active careAssigned patientAuthorized admin workflowExplicit MPI scope
Service-owned openEHR compositionsReleased viewRead/write for matching service and templateClinical role/workflowConditional; admin is not clinical authorshipComposition scope and template contract
Other-service compositionsReleased viewDeniedClinically necessary readConditional and auditedExplicit system scope
Medication and allergy safetyReleased viewCross-service read; governed medication writesRead plus authorized workflow writesConditionalExplicit medication scope
Lab and diagnostic detailResult-release policyService provenance and route policy; otherwise deniedCross-service read; assigned workflow writesConditionalExplicit lab/diagnostic scope
Documents, images and binariesReleased viewService-owned where provenance resolvesClinically necessary readConditionalExplicit document scope
SHR/IPS and FHIR projectionsPatient endpoint/release rulesService-safe resourcesLongitudinal patient projectionConditionalExchange scope, partner policy and purpose
AQL, saved query and browserNo staff workbenchPatient rows only when service filtering is enforceableAssigned-patient rowsApproved reporting purposeApproved query scope
Population cohort/report/exportDeniedDenied through clinical APIsDenied through clinical APIsReporting role, approved query and disclosure controlsDedicated reporting/output contract
Care-team/consent administrationOwn choices where exposedSeparately authorized onlySeparately authorized onlyPrivacy/release authorityExplicit workflow scope
VIP, sealed or protected contentPatient release policyClearance or break-glassClearance or break-glassClearance and purpose requiredExplicit protected-data authority
Hard delete, EHR merge, template deleteDeniedDeniedDeniedDedicated high-risk role, confirmation and auditApproved administrative service only

Control Ownership

ControlAuthorityDecisionOwner
Identity, SSO and MFAKeycloak/OIDC realm and clientsIs the credential authentic?Identity administrator
Tenant boundarySigned AMCDR context, memberships and row-level controlsWhere may the actor operate?Platform/organisation administrator
Job capabilityKeycloak roles synchronized to AMCDR rolesMay the actor perform this class of work?Workforce/access administrator
Clinical serviceClinical Service Offering and workforce assignmentWhich service does the clinician represent?Facility/workforce administrator
Patient relationshipActive service workflow or explicit care-team membershipWhy may this actor access this patient now?Service/care-team manager
Patient privacyPortal consent and care-team privacyHas the patient limited routine access?Patient/delegate and privacy staff
Protected classificationRecord/template policy and clearancesIs additional clearance required?Protected-record officer
Emergency exceptionBreak-glass eligibility, reason, time and reviewIs emergency access justified?Emergency authority/privacy reviewer
API and resource policyRoute matrix, policies and SMART/API scopesIs this method/resource permitted?Platform/security administrator
Release and exportRelease, sharing and query governanceMay data be shown or leave AMCDR?Release/data-governance authority

Deny Precedence

  1. Invalid, expired, revoked or incorrectly addressed credential.
  2. Invalid signed tenant context or tenant, organisation or facility mismatch.
  3. Inactive user, membership, role, API credential, delegation or care-team membership.
  4. Route role or SMART/API scope excludes the method or resource.
  5. Matching executable deny policy.
  6. No qualifying patient relationship.
  7. Patient consent or care-team privacy excludes the actor.
  8. Protected-record or protected-template clearance is absent.
  9. Patient-facing result or document has not been released.
  10. Patient-safe query filtering, reporting authority or export control cannot be proven.

Worked Decisions

ScenarioDecisionReason
Mental Health psychiatrist opens an active service patientL3 serviceMental Health compositions and medication/allergy safety are available; unrelated cardiology records are not
The psychiatrist joins the explicit patient care teamL4 longitudinalClinically necessary cross-service data becomes available, subject to privacy and protection
Care-team clinician requests a sealed composition without clearanceDeniedCare-team access does not replace protected-record clearance
Patient opts out of whole-team routine accessDenied for routine team accessThe relationship remains auditable, but the patient's restriction is enforced
Eligible emergency clinician supplies break-glass reasonE1 overlayTime-limited access is audited and reviewed
Analyst submits identifiable AQL without reporting authorityDeniedQuery access cannot bypass row filtering or export governance
SMART token targets a different patientDeniedScope and represented-patient context do not match

Audit And Production Acceptance

Material decisions retain actor and credential type, tenant context, memberships and roles, service keys, represented patient, access level, purpose, route/action, decision identifiers, protected classification, emergency reason, outcome, timestamp and correlation ID. Query and export evidence additionally records the saved-query or normalized query reference, parameters, row count, output format, cache scope and protected-row treatment.

Production acceptance tests must cover allow and deny outcomes across Patient Workspace, direct APIs, openEHR, FHIR, SHR/IPS, AQL, saved queries, documents, caches and exports. Cross-tenant, stale-membership, opt-out, protected-record and identifier-alias cases are mandatory negative tests.

Related Guidance