Administrative Setup (Pre-requisites)
Member and Application Session
patient/*.read).onAuthenticateSuccess callback script:
-Grants the session read access to the member's Patient compartment.
-Stores the Patient ID, client ID, and user identifier claims as user data on the session.Usage Capture
The following diagram shows how a single FHIR request from a third-party application is authenticated, how the member and application claims are taken from the access token, and how they are added to the request's transaction log event.
sequenceDiagram
autonumber
participant App as Third-Party Application
participant Endpoint as Patient Access API Endpoint
participant Smart as SMART Inbound Security
participant Script as onAuthenticateSuccess Script
participant Interceptor as PatientAccessTxLogEnrichmentInterceptor
participant TxLog as Transaction Log
participant Kafka as Kafka Topic
App->>Endpoint: GET /Patient/patient-005<br/>Authorization: Bearer access token
Endpoint->>Smart: Authenticate request
Smart->>Smart: Validate token against the trusted IdP
Smart->>Script: onAuthenticateSuccess(theOutcome, theOutcomeFactory, theContext)
Script->>Script: Read claims patient, client_id or azp, sub
Script->>Script: Grant FHIR_READ_ALL_IN_COMPARTMENT Patient/patient-005
Script->>Script: setUserData patient_id, client_id, subject
Script-->>Smart: User session with permissions and user data
Smart-->>Endpoint: Authenticated user session
Endpoint->>Interceptor: SERVER_INCOMING_REQUEST_PRE_HANDLED
Interceptor->>Interceptor: Read user data from the user session
Interceptor-->>Endpoint: addAdditionalJsonProperty stores each value on the request
Endpoint->>Endpoint: Read Patient/patient-005 within the member's compartment
Endpoint-->>App: 200 OK with Patient resource
Endpoint->>TxLog: Write FHIR_REQUEST event, with the stored values as additionalJson
TxLog->>Kafka: Publish event to channel_patient_access_txlog
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.