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โ
| Feature | Detail |
|---|---|
| Deny-by-default enforcement | No consent record โ access denied |
| Operation-level granularity | r read, s search, c create, u update, d delete as separate permission letters |
| FHIR R4 Consent resource | Bidirectional sync with HAPI FHIR JPA |
| IHE ATNA audit trail | DICOM 110110 AuditEvent, async, non-blocking |
| Patient self-service portal | Grant, edit, view history, detail, and revoke consents |
| Multi-issuer JWT | Test Epic + Keycloak simultaneously without restarting |
| Opaque token introspection | RFC 7662 fallback for non-JWT tokens (some Epic configs) |
| Consent lifecycle webhooks | HTTP POST on create / update / revoke |
| SMART v1 + v2 scopes | .read/.write and .rs/.cud letter scopes both handled |
| Epic / Cerner / Azure AD | Configurable JWT claim mapping, URL-based patient ID extraction |
| 182 tests | Unit + 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.
| Feature | Community | Enterprise |
|---|---|---|
| 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โ
| Framework | What is covered |
|---|---|
| HIPAA ยง 164.508 | Authorisation for non-routine uses and disclosures |
| HTI-1 / TEFCA | Patient consent for TEFCA-based data sharing |
| GDPR Art.9 | Explicit consent for special category health data processing |
| GDPR Art.17 | Right 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:
| Service | Port |
|---|---|
| HAPI FHIR JPA | 8080 |
| SMART Auth Server | 9000 |
| Consent Manager | 8082 |
Next: Quick Start โ