Skip to main content

AJ FHIR Consent Manager

v1.0.0 ยท Spring Boot 3.3 ยท HAPI FHIR 7.4 ยท Java 21 ยท Apache 2.0

The AJ FHIR Consent Manager is an open source Spring Boot module that enforces patient consent on every FHIR request, manages the full FHIR R4 Consent resource lifecycle, provides a patient self-service portal, and writes an IHE ATNA-compliant audit trail.

It runs as a set of HAPI interceptors registered on your existing HAPI FHIR JPA server โ€” no separate FHIR server required.

GitHub: github.com/AKHester-Technologies/ajfhir-consent-manager
Licence: Apache 2.0
Community: FHIR Chat #consent

What it doesโ€‹

SMART App              Auth Server           HAPI FHIR
โ”‚ โ”‚ โ”‚
โ”‚โ”€โ”€ POST /token โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ โ”‚
โ”‚โ—„โ”€ access_token โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ”‚
โ”‚ โ”‚ โ”‚
โ”‚โ”€โ”€ GET /fhir/Observation/obs-001 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚
โ”‚ ConsentEnforcementInterceptor
โ”‚ โ”‚ checks ConsentRecord
โ”‚ โ”‚ โ†’ PERMIT or DENY
โ”‚โ—„โ”€ 200 OK / 403 Forbidden โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ AuditEvent written async โ”€โ”€โ”€โ”€โ–บโ”‚

Every FHIR request passes through ConsentEnforcementInterceptor before HAPI processes it. The interceptor extracts the patient and actor identities from the Bearer token, queries the consent cache, and either allows the request or returns a 403 Forbidden with a regulatory-tagged message.

Key featuresโ€‹

FeatureDetail
Deny-by-default enforcementNo consent record โ†’ access denied
Operation-level granularityr read, s search, c create, u update, d delete as separate permission letters
FHIR R4 Consent resourceBidirectional sync with HAPI FHIR JPA
IHE ATNA audit trailDICOM 110110 AuditEvent, async, non-blocking
Patient self-service portalGrant, edit, view history, detail, and revoke consents
Multi-issuer JWTTest Epic + Keycloak simultaneously without restarting
Opaque token introspectionRFC 7662 fallback for non-JWT tokens (some Epic configs)
Consent lifecycle webhooksHTTP POST on create / update / revoke
SMART v1 + v2 scopes.read/.write and .rs/.cud letter scopes both handled
Epic / Cerner / Azure ADConfigurable JWT claim mapping, URL-based patient ID extraction
182 testsUnit + integration, 179 active

Community vs Enterpriseโ€‹

The Community Edition (this documentation) is Apache 2.0 licensed and covers all features in the open source release.

FeatureCommunityEnterprise
FHIR enforcement interceptorโœ“โœ“
REST API (CRUD + evaluate)โœ“โœ“
IHE ATNA audit trailโœ“โœ“
FHIR R4 bidirectional syncโœ“โœ“
patient/ scope enforcementโœ“โœ“
user/ scope enforcement (clinician-level)โœ“โœ“
system/ scope enforcement (backend services)โœ“โœ“
Multi-issuer JWTโœ“โœ“
Opaque token introspection (RFC 7662)โœ“โœ“
Consent lifecycle webhooksโœ“โœ“
Patient portal โ€” grant new consentโœ“โœ“
Patient portal โ€” edit existing consentโœ“โœ“
Patient portal โ€” view, history, revokeโœ“โœ“
Epic / Cerner / Azure AD portabilityโœ“โœ“
OAuth2 consent screen (SMART app launch)โ€”โœ“
Break-glass emergency accessโ€”โœ“
Break-glass compliance review workflowโ€”โœ“
Admin / compliance portalโ€”โœ“
Multi-tenant row-level isolationโ€”โœ“
Certified EHR connector profilesโ€”โœ“

Enterprise Edition: akhester.com

Regulatory coverageโ€‹

FrameworkWhat is covered
HIPAA ยง 164.508Authorisation for non-routine uses and disclosures
HTI-1 / TEFCAPatient consent for TEFCA-based data sharing
GDPR Art.9Explicit consent for special category health data processing
GDPR Art.17Right to withdraw โ€” revocation effective immediately
DISHA (India)Electronic health data access consent
My Health Record Act 2012 (AU)Patient-controlled access model

Port and deploymentโ€‹

The Consent Manager runs on port 8082 alongside the platform:

ServicePort
HAPI FHIR JPA8080
SMART Auth Server9000
Consent Manager8082

Next: Quick Start โ†’