Package org.fhirfrog.frog.smart
package org.fhirfrog.frog.smart
Pluggable SMART on FHIR App Launch 2.0 auth strategies.
This package defines SmartAuthProvider, a small
strategy interface for obtaining a SMART access token, decoupled from
fhir-frog-library's generic ClientRequestInterceptor hook that actually
attaches the resulting token to outgoing FHIR requests. See
SmartAuthProvider.asRequestInterceptor() for the glue
between the two.
Strategies
StaticTokenProvider- wraps a pre-obtained token, for targets where the token is fetched out-of-band.FormLoginPkceProvider- drives the plain-HTTP PKCE authorization-code flow with Spring Security form login used byaehrc-quokka-hapi-smart's test IdP (and any other SMART test server shaped the same way).EhrLaunchProvider- the SMART App Launch 2.0 EHR launch flow (as opposed toFormLoginPkceProvider's standalone launch), with three modes:EhrLaunchProvider.preAuthorizedToken(String)(zero HTTP calls),org.fhirfrog.frog.smart.EhrLaunchProvider#preAuthorizedCode(String, String, String, String, String, String)(one HTTP call), andorg.fhirfrog.frog.smart.EhrLaunchProvider#fullWalk(String, String, String, String, String, String, org.fhirfrog.frog.smart.AuthorizePageHandler)(the full, best-effort walk). Also decodes the SMART launch context (LaunchContext) alongside the access token.
Deliberately not implemented here (see design.md's Non-Goals): a
HeadlessBrowserProvider for real IdPs with no test-user bypass, and a
ClientCredentialsProvider for system-to-system targets with no login step.
Nothing in this org's current test suites needs them yet.
-
ClassDescriptionPluggable strategy for turning an interactive SMART
authorization_endpointresponse into the next request that continuesEhrLaunchProvider'sfullWalkauthorization-code flow.SmartAuthProviderstrategy for the OAuth2client_credentialsgrant used by SMART Backend Services clients - a confidential, system-to-system client authenticating with its ownclient_id/client_secretrather than a user login, the one strategy this package's design explicitly left unbuilt until frog-runner needed to write to a real write-capable FHIR tenant (seefhirfrog/sparked-fhir-server-configuration#95).SmartAuthProviderstrategy for the SMART App Launch 2.0 EHR launch flow - the case where an EHR (or an EHR simulator such asehr.smartforms.io) launches an app with an opaque or base64-JSONlaunchtoken, rather than the app being started standalone the wayFormLoginPkceProviderdrives it.SmartAuthProviderstrategy that drives the plain-HTTP PKCE authorization-code flow with Spring Security form login used byaehrc-quokka-hapi-smart's own test IdP:GET /oauth2/authorize→GET /login→ scrape the CSRF token →POST /login→ follow the redirect for the authorization code →POST /oauth2/token.The SMART launch context decoded from a token-endpoint JSON response: thepatient/encounteridentifiers,id_token, grantedscope, token lifetime, and anyfhirContextentries (SMART App Launch's mechanism for the EHR to hand the launched app a set of relevant resources up front - e.g. launching straight into a pre-selectedQuestionnaire).One entry of a SMARTfhirContextlaunch-context array - see the SMART App Launch spec's "fhirContext" launch parameter.Thrown when aSmartAuthProviderstrategy fails to obtain an access token - e.g.A pluggable strategy for obtaining a SMART on FHIR access token.TrivialSmartAuthProviderwrapping a pre-obtained access token, for targets where the token is fetched out-of-band (e.g. a token pasted in from a manual browser login, or obtained by some other tool entirely outside fhir-frog).