Skip to content

spring-boot-starter that automatically requests an access token and keeps it up to date via the SMART Backend Service flow (http://build.fhir.org/ig/HL7/bulk-data-export/authorization/index.html). This allow applications to simply configure the SMART Service properties and have an access token available to query the FHIR store

License

Notifications You must be signed in to change notification settings

Koppeltaal/Koppeltaal-2.0-Spring-SMART-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koppeltaal-2.0-Spring-SMART-Service

This dependency injects its services into an existing Spring Boot application. This adds the following functionality:

  • a JWKS endpoint (through spring-boot-starter-jwks)
  • A SmartServiceConfiguration object to configure the FHIR Server
  • A SmartClientCredentialService that automatically requests the access_token and refreshes it when needed
  • A JwtValidationService that verifies if the JWT auth token is still valid. If not, it will refresh
  • An AuditEventService that automatically sends Audit Events to the FHIR Store.
  • Resource services that bidirectionally manage data fom the FHIR store via DTO objects

The above will be achieved by simply adding configuring the application.properties. To get the access_token, use SmartClientCredentialService.getAccessToken()

Available properties

We can list the following properties:

fhir.smart.service.fhirServerUrl=https://staging-fhir-server.koppeltaal.headease.nl/fhir
fhir.smart.service.clientId=epd-client-id
fhir.smart.service.scope=read/*
fhir.smart.service.auditEventsEnabled=true
fhir.smart.service.bearerTokenEnabled=true
fhir.smart.service.metaSourceUuid=urn:uuid:<UUID>

The metaSourceUuid value will be automatically appended to entities that are created in the FHIR store on the <Entity>.meta.source field. This field should never be changed once used.

The bearerTokenEnabled can be set to false to disable registering the BearerTokenAuthInterceptor. This should generally be left on the default (true) but can be set to false when developing against development environments where there is no auth server

Note: A secret isn't needed as the SMART service will sign the JWT with credentials provided by the JWKS library (through spring-boot-starter-jwks)

Limitations

Currently, the code is expecting the SMART backend service signature to use the RS512 algorithm.

Building the software

Requirements

Build software

  • Java 11
  • Maven 3

Downloading/pushing shared libraries

Koppeltaal 2.0 uses shared libraries as certain functionality (e.g. JWKS or SMART Backend Services) are used in many components. These shared libraries are published to GitHub Packages. In order to download these, you'll need a GitHub Personal Access Token with at least the read:packages scope.

After you have this token, you must add GitHub as a Maven server to your ~/.m2/settings.xml.

The <server> tag should be added like this, replace the username and password:

<server>
  <id>github</id>
  <username>{{YOUR_GITHUB_USERNAME}}</username>
  <password>{{YOUR_GITHUB_PERSONAL_ACCESS_TOKEN}}</password>
</server>

About

spring-boot-starter that automatically requests an access token and keeps it up to date via the SMART Backend Service flow (http://build.fhir.org/ig/HL7/bulk-data-export/authorization/index.html). This allow applications to simply configure the SMART Service properties and have an access token available to query the FHIR store

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •  

Languages