Skip to content

Commit 913d059

Browse files
NPA-6301: Update spec and proxy to enabled app-restricted-auth for sp… (#297)
…ecific endpoints # Pull Request ## 🧾 Ticket Link <!-- Add the Jira ticket link here --> https://nhsd-jira.digital.nhs.uk/browse/NPA-6301 --- ## 📄 Description/Summary of Changes <!-- Describe the changes made in this PR. Include the purpose/scope/impact of the changes --> - Updated Spec to let consumers know which endpoints have app restricted auth enabled as an access mode - Updated APIM proxy to no longer block the 4 endpoints specified in the ticket --- ## 🧪 Developer Testing Carried Out <!-- Describe what tests (automated/unit/manual etc.) have been done for the ticket. Include: --> <!-- - Any tests added/updated --> <!-- - Evidence that each acceptance criterion from the Jira ticket is met --> - Test evidence attached to ticket --- ## 🧪 Reviewer Testing Required <!-- Describe how to test the changes that have been made in the ticket. Include: --> <!-- - Testing environment details (e.g. sandbox/local setup) --> <!-- - Steps to verify the changes --> - [ ] <!-- Add bullet points for testing instructions --> - [ ] <!-- Add bullet points for testing instructions --> - [ ] <!-- Add bullet points for testing instructions --> --- ## ✅ Developer Checklist <!-- Complete before submitting the PR --> - [ ] PR title follows the format: `NPA-XXXX: <short-description>` - [ ] Branch name follows the convention: `<type>/NPA-XXXX/<short-description>` - [ ] Commit messages follow the template: `NPA-XXXX: <short-description>` - [ ] All acceptance criteria from the Jira ticket are addressed - [ ] Automated tests (unit/integration/API/infrastructure etc. tests) are added or updated - [ ] Assignees and appropriate labels (e.g. `terraform`, `documentation`) are added --- ## 👀 Reviewer Checklist <!-- To be completed by the reviewer --> - [ ] Changes meet the acceptance criteria of the Jira ticket - [ ] Code is able to be merged (no conflicts and adheres to coding standards) - [ ] Sufficient test evidence is provided (manual and/or automated) - [ ] Infrastructure/operational/build changes are validated (if applicable) --- ## 🚀 Post-merge <!-- Actions to complete after merging --> After merging and deploying changes to the sandbox, Postman collection or spec examples please run the Run Postman collection workflow. This will run the tests within the collection to check that the sandbox is working as expected once deployed.
1 parent 1fdb3be commit 913d059

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

proxies/live/apiproxy/resources/py/check-app-enabled-endpoint.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@
22
request_verb = flow.getVariable("request.verb").lower()
33

44
auth_forbidden = False
5-
if request_verb == "patch":
6-
# Check blocked endpoint is within path suffix i.e. ignore path parameters
7-
blocked_resources = ["/fhir/r4/consent"]
8-
for blocked_resource in blocked_resources:
9-
if blocked_resource in path_suffix:
10-
auth_forbidden = True
11-
else:
12-
# Check blocked endpoint is equal to path suffix
13-
requested_resource = (path_suffix, request_verb)
14-
blocked_resources = [
15-
("/fhir/r4/relatedperson", "get"),
16-
("/fhir/r4/questionnaire", "get"),
17-
("/fhir/r4/questionnaireresponse", "post"),
18-
("/fhir/r4/questionnaireresponse", "get"),
19-
("/fhir/r4/consent", "post"),
20-
]
21-
auth_forbidden = requested_resource in blocked_resources
5+
6+
# Check blocked endpoint is equal to path suffix
7+
requested_resource = (path_suffix, request_verb)
8+
blocked_resources = [
9+
("/fhir/r4/relatedperson", "get"),
10+
("/fhir/r4/questionnaire", "get"),
11+
("/fhir/r4/questionnaireresponse", "post"),
12+
]
13+
auth_forbidden = requested_resource in blocked_resources
2214

2315
flow.setVariable("app_auth_forbidden", auth_forbidden)

specification/validated-relationships-service-api.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ paths:
318318
This endpoint supports the following access modes:
319319
- Patient access
320320
- Healthcare worker access
321+
- Application-restricted access
321322
322323
## Sandbox test scenarios
323324
@@ -690,6 +691,7 @@ paths:
690691
691692
This endpoint supports the following access modes:
692693
- Healthcare worker access
694+
- Application-restricted access
693695
694696
## Sandbox test scenarios
695697
@@ -831,6 +833,7 @@ paths:
831833
832834
This endpoint supports the following access modes:
833835
- Healthcare worker access
836+
- Application-restricted access
834837
835838
## Sandbox test scenarios
836839
@@ -956,6 +959,7 @@ paths:
956959
This endpoint supports the following access modes:
957960
- Patient access
958961
- Healthcare worker access
962+
- Application-restricted access
959963
960964
## Sandbox test scenarios
961965
The sandbox supports a limited number of scenarios, and does not attempt to validate requests. The returned response is dependant on the `id` parameters.

0 commit comments

Comments
 (0)