SMART: Asymmetric (“private key JWT”) authentication
Aidbox supports SMART Asymmetric Private Key JWT Authentication to securely manage client authentication.
JWKS
When registering with a FHIR authorization server, the client should provide its public key for authentication. This key should be included in a JSON Web Key (JWK) format within a JWK Set (JWKS).
Key Requirements for JWKs:
No matter how a JWK Set is communicated to the Aidbox FHIR authorization server, each JWK shall represent an asymmetric key by including the kty
and kid
properties, with content conveyed using “bare key” properties (i.e., direct base64 encoding of key material as integer values). Specifically:
For RSA public keys:
Each JWK shall include the
n
(modulus) ande
(exponent) properties.Each JWK shall include the
crv
(curve),x
(x-coordinate), andy
(y-coordinate) properties.
Aidbox provides JWKS endpoint with RSA public key.
So you can use Aidbox's JWKS or your own.
Registering Client
Before a SMART client can run against a FHIR server, the client SHALL generate or obtain an asymmetric key pair and register its public key set as jsks_uri
in Client resource. Aidbox provides .well-known/jwks.json
endpoint so you can use it.
Authenticating to the Token endpoint
Once the client generates an authentication JWT, it requests an access token based on either the SMART App Launch or SMART Backend Services specifications. The authentication details are included using these additional properties in the token request:
Authentication JWT Header Values:
alg
*
Fixed value - RS384
kid
*
The identifier for the key pair used to sign this JWT must be unique within the client's JWK Set.
typ
*
Fixed value: JWT
.
jku
The TLS-protected URL to the JWK Set that contains the public key(s) accessible without authentication or authorization. When present, this shall match the Client.jwks_uri
value.
*- required value
Authentication JWT Claims:
iss
*
Client ID (issuer).
sub
*
Client ID (subject).
aud
*
Token endpoint URL - <AIDBOX_BASE_URL>/auth/token
.
exp
*
The expiration time for this authentication JWT is an integer, representing the number of seconds since the "Epoch" (1970-01-01T00:00:00Z UTC). This value must not exceed five minutes into the future.
jti
*
Unique token identifier to prevent replay attacks.
*- required value
Example
JWT:
JWT's parsed headers:
JWT's parsed claims:
Requesting an Access Token
This JWT should be used as client_assertion
a parameter in the access token request. See the full example in SMART Backend services.
Last updated