Guide 2. Implement client
As explained in the authentication flow, The Client needs to perform a couple of steps in order to consume a data service:
Generate a
client_assertionJWTRequest an
access_tokenAccess data service with
access_tokenConsume a data service
Validate a signed JWT
Integrate with backoffice systems
Step 1. Generate a client_assertion JWT
A client assertion is generated in the form of a JSON Web Token (JWT). This token encompasses the JWT header and the JWT payload (payload) encoded in JSON format, digitally signed to protect the authenticity and integrity of its data content.
A JWT consists of three parts:
a. JWT Header
b. JWT Payload
c. Signature
Step 1a. JWT Header
The JWT Header of the client_assertion consists of the following data:
Please note : the x5c parameter contains an example value, but with correct formatting of the JSON array.
The following rules apply to the content of the JWT header:
Except from the
alg,typandx5cparameter, the JWT header SHALL NOT contain other header parameters.Signed JWTs MUST use and specify the
RS256algorithm in thealgheader parameter.Signed JWTs MUST use and specify
JWTin thetypheader parameter.Signed JWTs MUST use the following value in the
x5cheader parameter :Contains the array of the complete certificate chain that is used for validating the JWTโs signature, up until a root certificate that is listed on the DSGO Trusted List.
The leaf certificate of the Client (Party A in the example header above) MUST be the first in the array, the root certificate MUST be the last.
Certificates MUST be formatted as base64 encoded DER values, according to RFC 7515 ยง4.1.6
How to use a .PEM file to build the array with the certificate chain as shown in the example above:
Start from your .PEM chain file (leaf + intermediates + root).
For each cert:
Remove -----BEGIN CERTIFICATE----- / -----END CERTIFICATE-----.
Remove line breaks.
Keep the base64 body as a single string.
Insert them into x5c in order [leaf, intermediates, root].
Step 1b. JWT Payload
The JWT payload of the client_assertion consists of the following data:
The following rules apply to the content of the payload:
The JWT MUST always contain the
iatclaimThe JWT MUST be set to expire in 30 seconds. The combination of
iatandexpclaims MUST reflect that. BothiatandexpMUST be in seconds, NOT milliseconds. See UTC Time formatting for requirements.The JWT MUST contain the
jticlaim for audit trail purposes. Thejtiis not necessary a GUID/UUID.The
issandsubclaims MUST contain the valid DSGO identifier of the Client (Party A).The
audclaim MUST contain only the valid DSGO identifier of the Server (Party B). Including multiple audiences creates a risk of impersonation and is therefore not allowed.Depending on the use of the JWT other JWT payload data MAY be defined.
Step 1c. Signature
The client_assertion JWT must be signed with the private key from the electronic seal certificate. This is the eIDAS certificate or the iSHARE test certificate as explained in guide 1.
All JWTs MUST be signed using the JSON Web Signature (JWS) standard which can be found at RFC 7515.
Step 2. Request an access_token
The Client requests an access_token via a POST call to the /token endpoint of the data service provider. For more information see the /token endpoint within the API specifications.
The token request body consists of the following data:
The following rules apply to the content of this body:
The
grant_typeparameter MUST beclient_credentials.The
scopeparameter MUST beiSHARE.The
client_idMUST contain a valid DSGO identifier of the Client (in this example Party A).The
client_assertion_typeMUST beurn:ietf:params:oauth:client-assertion-type:jwt-bearerThe
client_assertionMUST be a signed JWT payload (see below).
When the token request is successful, Party B responds with a Bearer access_token.
Step 3. Access data service with access_token
The Bearer access_token is used by the data service consumer to request access to a service offered by the resource server of the data service provider.
OAuth 2.0 authorization based on bearer token. MUST contain โBearer โ + access token value. Must be provided if restricted endpoints are needed. See example below:
Step 4. Consume a data service
In consuming the data service a Client needs to implement a function to use a request (GET) or a processing (POST, PUT, DELETE) pattern. The data service provider provides a /dataServices and /capabilities endpoint in which all data services and technical capabilities the organisation offers are registered. The dataServiceInfo object includes information about the data service offered.
Step 5. validate a signed JWT
Besides your own client assertion JWT as described in step 1 above, two types of server-side signed JWTs are used in DSGO to make a data transaction fully auditable.
DSGO states that you SHOULD always validate a signed JWT in order to fully trust it contents.
Validation can be done (programmatically) in the following way:
Extract the x5c header parameter value from the JWT, which contains the array of the complete certificate chain in the order of [leaf, intermediates, root]. See step 1a above for an example x5c value
Iterate through the certificate chain and perform the following checks
Is the Organisation Identifier on the leaf certificate the same as the
issandsubvalues in the JWT payload for (exampleNTRNL-98765432)are the dates valid
Check the path constraints (CA Flags). This validates if the issuer is allowed to sign
Cryptographic validation: did the issuer sign this certificate?
Validate -only- the root certificate agains the trusted list in the DSGO Participant Registry.
The trusted list in the DSGO Participant Registry can be retrieved through the /trustedList endpoint.
Validation goes as follows:
Make a SHA256 fingerprint of the extracted root certificate and check if that fingerprint is present in the trusted list.
Check if status is
grantedand validity isvalid
Step 6. Integrate with backoffice systems
After consuming a data service the response consists of data (or processed data) you probably want to store for further processing within your backoffice systems. You therefore need to integrate this Client component within your software landscape. The DSGO focuses on data exchanges between organisations and not within a single organisation. Therefore no guidance is given on this aspect of the implementation.
Further reading
Github repository with code snippets for implementing iSHARE functionality.
iSHARE
English
Detailed description of applying JSON Web Tokens within the DSGO framework.
digiGO
Dutch
Explanation of non-repudiation operations within the DSGO Trust Framework. Non-repudiation assures that an operation or event cannot be denied now or later by the parties involved.
digiGO
Dutch
Last updated