Skip to main content

AJ FHIR HAPI Plugin

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

A Spring Boot autoconfiguration plugin that pre-wires SMART discovery proxy and scope enforcement onto any HAPI FHIR JPA server. Drop the dependency in, set three properties, and your HAPI server speaks SMART App Launch v2.2.

GitHub: github.com/AKHester-Technologies/aj-smart-fhir-platform

What it doesโ€‹

SMART Client          HAPI FHIR JPA :8080 + Plugin        Auth Server :9000
โ”‚ โ”‚ โ”‚
โ”‚โ”€โ”€ GET /fhir/ โ”‚ โ”‚
โ”‚ .well-known/ โ”‚ SmartDiscoveryProxyFilter โ”‚
โ”‚ smart-configuration โ”‚โ”€โ”€ proxies to โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
โ”‚โ—„โ”€ SMART config โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚โ—„โ”€ response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ โ”‚ โ”‚
โ”‚โ”€โ”€ GET /fhir/Patient/ โ”‚ โ”‚
โ”‚ Authorization: Bearerโ”‚ SmartScopeAuthInterceptor โ”‚
โ”‚ โ”‚ validates scope in token โ”‚
โ”‚ โ”‚โ”€โ”€ checks patient/Patient.rs โ”‚
โ”‚โ—„โ”€ 200 OK / 403 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ”‚

Componentsโ€‹

ClassRole
SmartDiscoveryProxyFilterOncePerRequestFilter โ€” proxies GET /fhir/.well-known/smart-configuration to the Auth Server
SmartScopeAuthorizationInterceptorHAPI SERVER_INCOMING_REQUEST_PRE_HANDLED interceptor โ€” validates SMART scopes against the Bearer token
HapiFhirAutoConfiguration@EnableAutoConfiguration entry point โ€” wires both components when smart.auth-server-url is set
RemoteJwksConfigRemoteJWKSet bean โ€” RS256 JWT validation with automatic key rotation

Installationโ€‹

<dependency>
<groupId>org.ajfhir</groupId>
<artifactId>aj-smart-fhir-platform</artifactId>
<version>1.0.0</version>
</dependency>

Configurationโ€‹

smart:
auth-server-url: http://localhost:9000
fhir-base-url: http://localhost:8080/fhir
jwks-uri: http://localhost:9000/oauth2/jwks

That is the entire required configuration. The autoconfiguration registers both the proxy filter and the scope interceptor automatically.

Testsโ€‹

12 tests covering autoconfiguration wiring, scope grant logic, JWKS public-key-only exposure, and RSA key generation.