Mocking Context for patient users

Description of how to mock patient users.

In order to mock patient login, the AS accepts access token requests with “CPR “ as a parameter. This is enabled on a special test client with the id "patient_mock" on the “nemlogin“ realm.

Access token requests using either a refresh token or username/password are supported.

Parameter name

Description

Parameter name

Description

client_id

Required. The OAuth2 client id

grant_type

Required. Value ‘refresh_token’ or 'password'

refresh_token (grant_type = refresh_token )

Required. The refresh token of the current session

username (grant_type = password)

Required. The username of a keycloak user.

password (grant_type = password)

Required. The password of the keycloak user.

cpr

Required. CPR number of test patient
https://www.medcom.dk/opslag/koder-tabeller-ydere/tabeller/nationale-test-cpr-numre

episode_of_care_id

Optional. id of EpisodeOfCare 

NOTE: When using patient_mock, keycloak will create the Patient on the patient-server, if it does not exist.

Postman collection demonstrating access token request: