ЕСОЗ - публічна документація
PIS. Patient sign-up validation
Purpose
This WS is designed to validate signed content as a part of registration process, extract patient data if it is valid and create session token to do further steps
Key points
This method must be used only by Auth front-end
Validates signed content as well as jwt and patient data inside it
Generates session token (jwt) to confirm registration request
Specification
Validate signed content
Check
signed_content
andsigned_content_encoding
are submittedin case of error - return 422 ('required property signed_content was not present' or ‘required property signed_content_encoding was not present')
Check
signed_content
field is a valid base64 stringin case of error - return 422 ('Invalid signed content')
Check
signed_content_encoding
field value equals to 'base64'in case of error - return 422 ('value is not allowed in enum')
Check digital signature is valid
in case of error - return 401 with digital signature validation error message
Check that drfo from digital signature belongs to person in registration request, based on field format:
if value equals to tax_id regexp (
^[0-9]{10}$
), field contains tax_id, usetax_id
field from registration request to compare;if value equals to national_id number regexp (
^[0-9]{9}$
), field contains national_id number, usedocuments.number
field withdocuments.type = 'NATIONAL_ID'
to compare;if value contains at least one letter, perform reverse transliteration of field using existing algorithm (described here), then check that value equals to passport number regexp (
^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$
), in case equals, field contains passport number, usedocuments.number
field withdocuments.type = 'PASSPORT'
to compare;in case of error - return 409 ('Registration person and person that sign should be the same')
Check that last_name from digital signature belongs to person in registration request, last_name field
in case of error - return 422 ('Input name doesn't match name from digital signature')
Check that first_name from registration request is present in string given_name from digital signature
in case of error - return 422 ('Input name doesn't match name from digital signature')
Validate person registration request
Person registration request itself must contains patient (person) data, some consents and valid JWT as part of PIS authorization
Validate person data according to Rules to validate patient data | Regular person
Check
patient_signed
field value equals to ‘true’in case of error - return 422 ('value is not allowed in enum')
Check
process_disclosure_data_consent
field value equal to ‘true’in case of error - return 422 ('value is not allowed in enum')
Validate JWT
validate JWT signature
validate issuer (
iss
= Ehealth)validate expiration (
exp
in the future)in case of any error - return 401 ('JWT is invalid.')
Service logic
Generate JWT
Fetch JWT TTL value from
JWT_LOGIN_TTL
env parameter (in minutes).Get
signed_content
field and calculate its MD5 hash.Generate JWT with following parameters:
alg =
RS512
aud =
pis-registration
content_hash = MD5 hash of
signed_content
field valueexp = iat +
JWT_LOGIN_TTL
iat = now()
iss =
EHealth
jti = generate uuid of JWT
nbf = now() - 1 second
sub = content_hash
typ =
access
Render person data
Render person (patient) data according to specification
ЕСОЗ - публічна документація