Skip to main content
Type
Guide

Introduction

The Health Connect Australia Provider Directory (HCAPD) server is an OAuth 2.0 resource server requiring valid OAuth 2.0 access tokens presented by a client to access resources.

The HCAPD API access tokens are issued by the National Digital Health Authorisation Service (NDHAS), which implements an OAuth 2.0 authorization server. The HCAPD APIs currently offers access to organisations using system-based authorisation, which is implemented following the OAuth 2.0 client credentials grant as described in section 1.3.4 of RFC 6749.

A HCAPD API access token represents the permissions that the NDHAS determines for the OAuth 2.0 client at the time when the access token is requested. A HCAPD client must

  • be a confidential client that is registered with the NDHAS following the Dynamic Client Registration protocol as described in RFC 7591 
  • authenticate using a trusted certificate as described in RFC 8705. The current trusted certificates are issued by the National Authentication Service for Health (NASH). 
  • perform Dynamic Client Registration using a Conformant Software and possess a NASH certificate.

Conformant Software

A client seeking registration with the NDHAS must use a software product that has achieved the relevant conformance status and recorded within the Register of Conformance. 

Client

A client is an instance of a conformant software that an Organisation uses to digitally interact with the NDHAS or the HCAPD.

NASH Certificate

To connect to the NDHAS and HCAPD, either of the following two types of NASH certificate can be used 

  • HPI-O NASH certificate - issued to a Healthcare Provider Organisation 
  • CSP NASH certificate - issued to a Contracted Service Provider

Please refer Services Australia: Apply for a NASH Certificate for further information and process to obtain NASH Certificate.

When to use HPI-O NASH Certificate?

If the conformant client is operated by an entity registered as a Healthcare Provider Organisation with the Services Australia Health Identifiers (HI) Service, then the client will

  • use CIS as the value for client system type data item, 
  • use Healthcare Provider Organisation (the operator)’s HPI-O NASH certificate for Dynamic Client Registration and access token request.

When to use CSP NASH Certificate?

If the conformant client is operated by an entity registered as a Contracted Service Provider with the HI Service, then the client will

  • use CSP as the value for client system type data item, 
  • use Contracted Service Provider (the operator)’s CSP NASH certificate for Dynamic Client Registration and access token request.

Please refer to the HI Service web page for further information and process to register with the HI Service.

Dynamic Client Registration

A client must submit a dynamic client registration request to the NHDAS to register its client details and obtain a client_id. 

The client_id is then used to identify the client to NHDAS in any subsequent access token requests. 

Dynamic client registration requires that the client must authenticate by presenting a trusted certificate, which is currently issued by NASH. The client must support mTLS version 1.2 or later.

Step 1: Initial Registration

The following diagram shows the high-level sequence of activities of Dynamic Client Registration

initial-registration-flow-diagram

The sequence has the following steps:

  1. The client generates a dynamic client registration http request with registration content as the request payload (body) as a JSON object. The table below describes the JSON object (i.e. registration parameters)

Registration Parameters:

ParameterOptionalityDetails
client_nameOptionalHuman-readable name of the client. This is used to display the client name to a user (person) of HCAAS
client_system_typeMandatory

Type of client system. 

Current supported values are 

  • CIS if the client is registered for a healthcare provider organisation, or 
  • CSP if the client is registered for a Contracted Service Provider. 

Additional values may be permitted in the future

token_endpoint_auth_methodMandatoryFixed: set to tls_client_auth
grant_typesMandatoryFixed: set to client_credentials
tls_client_auth_subject_dnMandatoryA string representation -- as defined in RFC4514 -- of the expected subject distinguished name of the certificate that the OAuth client will use in mutual-TLS authentication.
software_idMandatoryA string issued by the Register of Conformance that identifies the conformant software product. “software_id” remains the same across instances of the client application
software_versionMandatorySemantic version identifier for the client application identified by “software_id”.
platformMandatoryA string that identifies the Operating System or the technology platform (a Server Software name and version) in which a client is deployed, configured, secured and managed.
digital_health_systemMandatory

A single string containing a space-separated list of digital services (products). Each string indicates which digital health system (service) the client requires access to.

 

Current support value is fixed to system.hca.pd

scopeOptional

A single string containing a space-separated list scope that the client is registering for. 

 

Constraint: If scope is presented in the request, the scope values cannot exceed the scope recorded for the software product in the Register of Conformance. 

 

Default: If scope is not presented in the request, no HCAPD related scope will be registered for the client.

 

The scope values allowed for HCPAD are 

  • pd/system/*.rs (permission to read or search all resource types)
  • pd/system/*.e (permission to extract all resource types)

Example Request

dcr-request-code-screenshot
  1. The client sends the dynamic client registration request to the NDHAS registration endpoint via a https POST and presents a client NASH certificate for mTLS.
     
  2. The NDHAS validates the client’s NASH certificate and checks it against the Certificate Revocation List (CRL).
     
  3. The NDHAS checks the software product details (software_id and software_version) provided in the dynamic client registration request against the Register of Conformance to ensure the software product is conformant for accessing the HCAPD. NDHAS validates the Scope value if provided.
     
  4. The NDHAS generates a client_id and record it with the registration details.
     
  5. The NDHAS returns the client_id to the client.

Example Response:

dcr-response-code-code-screenshot
  • client_id is the OAuth 2.0 client identifier string. It is unique to the registered client within NDHAS.
  • registration_client_uri is a string containing the fully qualified URL for the client configuration endpoint, which can be used to read/modify/cancel client registration.
  • registration_access_token is a string containing the access token to be used at the client configuration endpoint.

Step 2: Read Registration

Upon successful completion of a client registration, the client can read the registration information by issuing a GET operation against the endpoint in registration_client_uri and using registration_access_token as authorisation. This operation requires the client's certificate for mTLS.

Example Request

dcr-read-request-sample-code

Step 3: Modify Registration

After a successful client registration, the client may modify the registration by issuing a PUT operation against the endpoint in registration_client_uri and using registration_access_token as authorisation. 

Only client_name and scope can be modified. This operation requires the client's certificate for mTLS.

Example Request

dcr-modify-request-code-sample-screenshot

Step 4: Cancel Registration

To cancel an existing registration, the client issues a DELETE operation against the endpoint in registration_client_uri and using registration_access_token as authorisation. This operation requires the client's certificate for mTLS.

Example Request

dcr-cancel-request-sample-code-screenshot

Step 5: Access Token Request

The access token request requires the registered client to present a certificate that has the same common name as the certificate used for dynamic client registration. 

Client certificate renewal does not require the client to be re-registered, as long as the renewed certificate has the same common name. The client must support mTLS version 1.2 or later.

The following diagram shows the high-level sequence of access token request.

access-token-request-diagram

The sequence has the following steps:

A: The client generates a token request which includes the following parameters.

Token Request Parameters:

ParameterOptionalityDetails
client_idMandatoryThe client_id assigned by the NDHAS upon successful client registration
grant_typeMandatoryFixed: set to “client_credentials”
accessing_org_idMandatory

The identifier of the organisation that is accessing data in the resource server.

 

Constraints:

  • If the client is registered for a healthcare provider organisation (client_system_type = CIS), then the organisation identifier (i.e. HPI-O) in this parameter must match the organisation identifier associated with the client certificate.
  • If the client is registered for a CSP (client_system_type = CSP), the organisation identifier in this parameter will be the HPI-O of a Healthcare Provider Organisation1, while the organisation identifier associated the client certificate will be the CSP number. 

     

    1The NDHAS will verify if the CSP can act on behalf of the accessing organisation before issuing an access token. Note that a healthcare provider organisation can link their HPI-O to a CSP in the Healthcare Identifiers Service vis the Health Professional Online Service.

accessing_org_nameOptional

The name of the organisation that is accessing data in the resource server.

Constraints

If provided it should match the name as registered with the HI Service.

alternate_org_nameOptionalAlternate name of the accessing organisation.
digital_health_systemMandatory

A single string containing a space-separated list of digital services (products). Each string indicates which digital health system (service) the client requires access to.

 

Current support value is fixed to system.hca.pd

scopeOptional

Scopes reflecting the requested access to the resource server. 

If scope is provided, access token will include the requested scope, provided that it does not exceed the client’s registered scope. 

For the HCAPD refer to scope parameter defined section 5.1 of this document.

   

Example Request

access-token-request-code-sample-screenshot

B: The client sends the token request to the NDHAS via a http POST and presents a client NASH certificate for mTLS.

C: The NDHAS validates the client’s NASH certificate and checks it against the Certificate Revocation List (CRL).

D: The NDHAS checks the software product details registered for the client against the Register of Conformance to ensure the software product remains conformant since registration.

E: If the client_system_type is CIS the NDHAS checks that the access_org_id in the request matches the organisation identifier in the client certificate presented for mTLS.

F: If the client_system_type is CSP the NDHAS checks with the Healthcare Identifiers Service that the CSP as identified by the client certificate is authorised to access the HCAPD on behalf of the organisation identified by the access_org_id (HPI-O).

G: The NDHAS determines the scope to be included in the access token.

H: The NDHAS generates a JWT access token and signs it using the HCAAS private key.

I: The NDHAS returns the access token to the client.

Step 6: Access Token Response

The successful access token response will contain the following details:

ParameterOptionalityDetails
access_tokenMandatoryThe NDHAS generated JWT
token_typeMandatoryFixed: set to “Bearer”
expires_inMandatoryThe lifetime in seconds of the access token. Not more than 3600 seconds (60 minutes)
   

Access Token JWT Structure

Header

ParameterOptionalityDetails
algMandatoryAlgorithm: The JWA algorithm used for signing the authentication JWT- must be: RS256
typMandatoryType: Fixed value: JWT
kidMandatoryKey identifier to pick the NDHAS public key from JWKS for signature validation.
   

Payload

ParameterOptionalityDetails
issMandatoryIssuer: URL of the token endpoint exposed by the HCAAS.
iatMandatoryIssued at time for the access token, expressed in seconds since the "Epoch" (1970-01-01T00:00:00Z UTC).
expMandatoryExpiration time integer for the access token, expressed in seconds since the "Epoch" (1970-01-01T00:00:00Z UTC). This time shall be no more than 3600 seconds ahead of the iat value.
jtiMandatoryA nonce string value that uniquely identifies this JWT.
digital_health_systemMandatoryFixed to "system.hcp.pd".
client_idMandatoryThe client_id issued by the HCAAS to the client upon successful registration
cnf.x5t#S256Mandatory

The JWT certificate thumbprint confirmation as specified in RFC 8705. E.g.

"cnf":{"x5t#S256": "bwcK0esc3ACC3DB2Y5_lESsXE8o9ltc05O89jdN-dg2"}

This will allow a resource server to check the access token against the mTLS certificate presented by the client, mitigating the token replay risk.

client_certificate_cnMandatoryThe common name of the client certificate.
client_system_typeMandatoryType of client system. Current supported values are “CIS” if the client is registered for a healthcare provider organisation, or “CSP” if the client is registered for a Contracted Service Provider.
Additional values may be permitted in the future.
accessing_org_idMandatoryThe fully qualified identifier of the claimed organisation that is accessing data in the resource server. The accessing organisation is not always the requesting organisation. E.g. the requesting organisation may be a Contracted Service Provider, while the access organisation may be a healthcare provider organisation.
accessing_org_nameOptionalThe name of the organisation that is accessing data in the resource server.
alternate_org_nameOptionalAlternate name of the accessing organisation.
scopeMandatoryScopes reflecting the authorised access to the resource server.
   

Signature

  • The JWT is signed using the NDHAS private key and assembled using JWS compact serialisation as per RFC 7515.
  • Computed over base64url(header) + "." + base64url(payload) using the private key corresponding to kid.

Step 7: Using An Access Token

After obtaining an access token, the client can access the HCAPD APIs by presenting the access token and the client’s NASH certificate for mTLS.