Type Guide This is the current version. IntroductionThe 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 mustbe 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 SoftwareA 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. ClientA client is an instance of a conformant software that an Organisation uses to digitally interact with the NDHAS or the HCAPD.NASH CertificateTo 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 ProviderPlease 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 willuse 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 willuse 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 RegistrationA 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 RegistrationThe following diagram shows the high-level sequence of activities of Dynamic Client Registration The sequence has the following steps: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:ParameterOptionalityDetailsclient_nameOptionalHuman-readable name of the client. This is used to display the client name to a user (person) of HCAASclient_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 futuretoken_endpoint_auth_methodMandatoryFixed: set to tls_client_authgrant_typesMandatoryFixed: set to client_credentialstls_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 applicationsoftware_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_systemMandatoryA 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.pdscopeOptionalA 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 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. The NDHAS validates the client’s NASH certificate and checks it against the Certificate Revocation List (CRL). 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. The NDHAS generates a client_id and record it with the registration details. The NDHAS returns the client_id to the client.Example Response: 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 RegistrationUpon 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 Step 3: Modify RegistrationAfter 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 Step 4: Cancel RegistrationTo 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 Step 5: Access Token RequestThe 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. The sequence has the following steps:A: The client generates a token request which includes the following parameters.Token Request Parameters:ParameterOptionalityDetailsclient_idMandatoryThe client_id assigned by the NDHAS upon successful client registrationgrant_typeMandatoryFixed: set to “client_credentials”accessing_org_idMandatoryThe 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_nameOptionalThe name of the organisation that is accessing data in the resource server.ConstraintsIf provided it should match the name as registered with the HI Service.alternate_org_nameOptionalAlternate name of the accessing organisation.digital_health_systemMandatoryA 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.pdscopeOptionalScopes 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 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 ResponseThe successful access token response will contain the following details:ParameterOptionalityDetailsaccess_tokenMandatoryThe NDHAS generated JWTtoken_typeMandatoryFixed: set to “Bearer”expires_inMandatoryThe lifetime in seconds of the access token. Not more than 3600 seconds (60 minutes) Access Token JWT StructureHeaderParameterOptionalityDetailsalgMandatoryAlgorithm: The JWA algorithm used for signing the authentication JWT- must be: RS256typMandatoryType: Fixed value: JWTkidMandatoryKey identifier to pick the NDHAS public key from JWKS for signature validation. PayloadParameterOptionalityDetailsissMandatoryIssuer: 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 registrationcnf.x5t#S256MandatoryThe 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. SignatureThe 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 TokenAfter obtaining an access token, the client can access the HCAPD APIs by presenting the access token and the client’s NASH certificate for mTLS.