Skip to content

Commit

Permalink
Merge pull request #296 from NHSDigital/develop
Browse files Browse the repository at this point in the history
Develop PR For Release cut 1.9.0
  • Loading branch information
RajaGovindharaj16 authored May 20, 2022
2 parents 62bb062 + f1c2e7a commit 5cf43fb
Show file tree
Hide file tree
Showing 26 changed files with 737 additions and 193 deletions.
3 changes: 2 additions & 1 deletion azure/templates/ers-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ steps:
export ERS_TEST_ASID="$(ers-testing-asid)"
export OAUTH_PROXY="oauth2-mock"
export OAUTH_BASE_URI="https://$(ENVIRONMENT).api.service.nhs.uk"
export JWT_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(JWT_TESTING_PRIVATE_KEY)"
poetry run pytest -v tests/integration --junitxml=tests/ers-test-integration-report.xml
displayName: Run eRS integration tests
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
Expand Down
3 changes: 2 additions & 1 deletion azure/templates/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ steps:

- template: "azure/components/get-aws-secrets-and-ssm-params.yml@common"
parameters:
secret_file_ids: []
secret_file_ids:
- ptl/app-credentials/jwt_testing/non-prod/JWT_TESTING_PRIVATE_KEY
config_ids: []
secret_ids:
- ptl/api-deployment/e-referrals-service/ers-testing-asid
Expand Down
7 changes: 6 additions & 1 deletion manifest_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ ACCESS_MODES:
scopes: ['urn:nhsd:apim:user-nhs-id:aal3:e-referrals-service-api']
requireCallbackUrl: true
description: User restricted

- name: application-restricted
nameSuffix: -application-restricted
displayName: Application Restricted
scopes: ['urn:nhsd:apim:app:level3:e-referrals-service-api']
requireCallbackUrl: false
description: Application Restricted

---

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.Set.nhsd-ers-business-function-header-app-restricted">
<Set>
<Headers>
<Header name="x-ers-business-function">AUTHORISED_APPLICATION</Header>
</Headers>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"/>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.Set.nhsd-ers-ods-code-header-app-restricted">
<Set>
<Headers>
<Header name="x-ers-ods-code">{app.app-restricted-ods-code}</Header>
</Headers>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"/>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.Set.x-ers-user-id-header-app-restricted">
<Set>
<Headers>
<Header name="x-ers-user-id">{app.app-restricted-user-id}</Header>
</Headers>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"/>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.RemoveAndAddUserIdHeader">
<Remove>
<Headers>
<Header name="x-ers-user-id"/>
</Headers>
</Remove>
<Add>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.Set.x-ers-user-id-header-user-restricted">
<Set>
<Headers>
<Header name="x-ers-user-id">{accesstoken.id_token-subject}</Header>
</Headers>
</Add>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"/>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.RemoveAndAddAsidHeader">
<Remove>
<Headers>
<Header name="XAPI_ASID"/>
</Headers>
</Remove>
<Add>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.SetAsidHeader">
<Set>
<Headers>
<Header name="XAPI_ASID">{private.apigee.NHSD-ASID}</Header>
</Headers>
</Add>
</Set>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"/>
</AssignMessage>
3 changes: 1 addition & 2 deletions proxies/live/apiproxy/policies/OAuthV2.VerifyAccessToken.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OauthV2.VerifyAccessToken">
<Operation>VerifyAccessToken</Operation>
<!-- Set Scope to accept only AAL3 security level. -->
<Scope>urn:nhsd:apim:user-nhs-id:aal3:e-referrals-service-api</Scope>
<Scope>urn:nhsd:apim:app:level3:e-referrals-service-api urn:nhsd:apim:user-nhs-id:aal3:e-referrals-service-api</Scope>
</OAuthV2>
35 changes: 27 additions & 8 deletions proxies/live/apiproxy/targets/ers-target.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Name>AssignMessage.PopulateAsidFromApp</Name>
</Step>
<Step>
<Name>AssignMessage.RemoveAndAddAsidHeader</Name>
<Name>AssignMessage.SetAsidHeader</Name>
</Step>
<Step>
<Name>AssignMessage.AddBaseUrlHeader</Name>
Expand Down Expand Up @@ -63,7 +63,7 @@
<Name>RaiseFault.403Forbidden</Name>
<Condition>(request.header.nhsd-ers-business-function == "AUTHORISED_APPLICATION")</Condition>
</Step> <Step>
<Name>AssignMessage.RemoveAndAddUserIdHeader</Name>
<Name>AssignMessage.Set.x-ers-user-id-header-user-restricted</Name>
</Step> <Step>
<Name>AssignMessage.Swap.NHSD-eRS-On-Behalf-Of-User-ID</Name>
<Condition>(request.header.NHSD-eRS-On-Behalf-Of-User-ID ~~ ".+")</Condition>
Expand All @@ -89,19 +89,38 @@
<Condition>(request.header.echo)</Condition>
</Step> {% endif %} <Step>
<!--This should always be the last Step - as it is just before the message is sent - so the initial request stays intact for as long as possible.
The Swapping of the Request Headers converts X-Correlation-ID to NHSD-Correlation-ID before sending to backend. -->
The Swapping of the Request Headers converts X-Correlation-ID to NHSD-Correlation-ID before sending to backend. -->
<Name>AssignMessage.Swap.CorrelationHeader</Name>
</Step></Request>
<Response/>
</Flow>
<!-- App restricted not yet supported -->
<Flow name="app-restricted-flow">
<Condition>(accesstoken.auth_type == "app")</Condition>
<Request>
<Step>
<Request><!-- reject if headers that are overriden as part of app rectricted call are provided--><Step>
<Name>RaiseFault.403Forbidden</Name>
</Step>
</Request>
<Condition>(request.header.x-ers-ods-code)</Condition>
</Step> <Step>
<Name>RaiseFault.403Forbidden</Name>
<Condition>(request.header.x-ers-business-function)</Condition>
</Step> <Step>
<Name>RaiseFault.403Forbidden</Name>
<Condition>(request.header.x-ers-user-id)</Condition>
</Step> <Step>
<Name>AssignMessage.Set.nhsd-ers-ods-code-header-app-restricted</Name>
</Step> <Step>
<Name>AssignMessage.Set.nhsd-ers-business-function-header-app-restricted</Name>
</Step> <Step>
<Name>AssignMessage.Set.x-ers-user-id-header-app-restricted</Name>
</Step><Step>
<Name>AssignMessage.Remove.x-request-id-header</Name>
</Step> {% if ALLOW_ECHO_TARGET | default(false) == true %} <Step>
<Name>AssignMessage.SetEchoTarget</Name>
<Condition>(request.header.echo)</Condition>
</Step> {% endif %} <Step>
<!--This should always be the last Step - as it is just before the message is sent - so the initial request stays intact for as long as possible.
The Swapping of the Request Headers converts X-Correlation-ID to NHSD-Correlation-ID before sending to backend. -->
<Name>AssignMessage.Swap.CorrelationHeader</Name>
</Step></Request>
<Response/>
</Flow>
<!-- Something went wrong as one of the above flows should have triggered, this flow should never trigger in normal operation-->
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"id": "000000070011",
"meta": {
"versionId": "5",
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ReferralRequest-1"
]
},
"resourceType": "ReferralRequest",
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ClinicalInfoFirstSubmitted-1",
"valueDateTime": "2021-06-11T12:09:08.667Z"
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralPriority-1",
"valueCodeableConcept": {
"coding": [
{
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
"code": "ROUTINE",
"display": "Routine"
}
]
}
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-ReferralShortlist-1",
"valueReference": {
"reference": "#shortlist"
}
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Commissioning-Rule-Org-1",
"valueIdentifier": {
"system": "https://fhir.nhs.uk/Id/ods-organization-code",
"value": "R69"
}
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-PatientAdditionalRequirement-1",
"valueCoding": {
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AdditionalRequirementType-1",
"code": "ADVOCACY",
"display": "Advocacy"
}
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-PatientAdditionalRequirement-1",
"valueCoding": {
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AdditionalRequirementType-1",
"code": "INTERPRETER",
"display": "Interpreter"
}
},
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-PatientAdditionalRequirement-1",
"valueCoding": {
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AdditionalRequirementType-1",
"code": "TRANSPORT",
"display": "Transport"
}
}
],
"contained": [
{
"id": "serviceSearchCriteria",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/eRS-ServiceSearchCriteria-Parameters-1"
]
},
"resourceType": "Parameters",
"parameter": [
{
"name": "priority",
"valueCoding": {
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-Priority-1",
"code": "ROUTINE"
}
},
{
"name": "specialty",
"valueCoding": {
"system": "_baseUrl_/STU3/CodeSystem/SPECIALTY",
"code": "CARDIOLOGY"
}
},
{
"name": "clinicType",
"valueCoding": {
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-ClinicType-1",
"code": "HEART_FAILURE"
}
},
{
"name": "postcode",
"valueString": "LS1 2TW"
},
{
"name": "distanceLimit",
"valueUnsignedInt": 123
},
{
"name": "ageAndGenderAppropriate",
"valueBoolean": true
}
]
},
{
"id": "shortlist",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/eRS-Shortlist-List-1"
]
},
"resourceType": "List",
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-Shortlist-SearchCriteria-1",
"valueReference": {
"reference": "#serviceSearchCriteria"
}
}
],
"status": "current",
"mode": "snapshot",
"entry": [
{
"item": {
"identifier": {
"system": "http://fhir.nhs.net/Id/ers-service",
"value": "11002"
},
"display": "Good Cardiology Business Service"
}
}
]
},
{
"id": "DocumentReference-80000",
"meta": {
"profile": [
"https://fhir.nhs.uk/STU3/StructureDefinition/eRS-DocumentReference-1"
]
},
"resourceType": "DocumentReference",
"type": {
"coding": [
{
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-AttachmentType-1",
"code": "REFERRER",
"display": "Referrer"
}
]
},
"status": "current",
"indexed": "2021-06-11T12:09:09.459Z",
"description": "referralletter pdf",
"content": [
{
"attachment": {
"id": "80000",
"extension": [
{
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-eRS-AttachedBy-1",
"valueReference": {
"identifier": {
"system": "http://fhir.nhs.net/Id/sds-user-id",
"value": "021600556514"
}
}
}
],
"contentType": "application/pdf",
"url": "Binary/att-70000-80000",
"size": 6,
"title": "referralletter.pdf",
"creation": "2021-06-11"
}
}
]
}
],
"status": "active",
"subject": {
"identifier": {
"system": "http://fhir.nhs.net/Id/nhs-number",
"value": "9912003888"
}
},
"supportingInfo": [
{
"reference": "#DocumentReference-80000"
}
],
"intent": "plan"
}
Loading

0 comments on commit 5cf43fb

Please sign in to comment.