Skip to content

Commit 4765b2f

Browse files
NPA-4591: Add raise fault step for wrong auth level
1 parent 86cc778 commit 4765b2f

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

proxies/live/apiproxy/policies/OAuthV2.VerifyAccessTokenUserNhsLoginP9.xml renamed to proxies/live/apiproxy/policies/OAuthV2.VerifyAccessTokenUser.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<OAuthV2 async="false" continueOnError="false" enabled="true" name="VerifyAccessTokenUserNhsLoginP9">
1+
<!--Step 2: Adding VerifyAccessToken policy to your proxy-->
2+
<OAuthV2 async="false" continueOnError="false" enabled="true" name="VerifyAccessTokenUser">
23
<Operation>VerifyAccessToken</Operation>
3-
<Scopes>urn:nhsd:apim:user-nhs-login:P9:validated-relationships-service-api</Scopes>
4+
<Scopes>urn:nhsd:apim:user-nhs-login:P9:validated-relationships-service-api urn:nhsd:apim:user-nhs-id:aal3:validated-relationships-service-api</Scopes>
45
</OAuthV2>

proxies/live/apiproxy/policies/OAuthV2.VerifyAccessTokenUserCIS2AAL3.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

proxies/live/apiproxy/targets/target.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
<TargetEndpoint name="validated-relationships-service-api-target">
33
<PreFlow>
44
<Request>
5-
<!--Step 3: Configuring the VerifyAccessToken policy to restrict access-->
65
<Step>
7-
<Condition>(proxy.pathsuffix MatchesPath "/Consent") and (request.verb = "POST")</Condition>
8-
<Name>VerifyAccessTokenUserCIS2AAL3</Name>
9-
</Step>
10-
<Step>
11-
<Condition>(proxy.pathsuffix != "/Consent") or (request.verb != "POST")</Condition>
12-
<Name>VerifyAccessTokenUserNhsLoginP9</Name>
6+
<Name>VerifyAccessTokenUser</Name>
137
</Step>
148
<Step>
159
<Name>FlowCallout.ApplyRateLimiting</Name>
@@ -26,6 +20,14 @@
2620
<Step>
2721
<Name>AddUserAuthHeaders</Name>
2822
</Step>
23+
<Step>
24+
<Name>RaiseFault.401Unauthorized</Name>
25+
<Condition>accesstoken.auth_level != "aal3" and proxy.pathsuffix = "/FHIR/R4/Consent" and request.verb = "POST"</Condition>
26+
</Step>
27+
<Step>
28+
<Name>RaiseFault.401Unauthorized</Name>
29+
<Condition>accesstoken.auth_level != "p9" and (proxy.pathsuffix != "/FHIR/R4/Consent" or request.verb != "POST")</Condition>
30+
</Step>
2931
<Step>
3032
<Name>RaiseFault.415UnsupportedMediaType</Name>
3133
<Condition>request.verb = "POST" and request.header.Content-Type != "application/fhir+json" and request.header.Content-Type != "application/fhir+json; charset=utf-8"</Condition>

0 commit comments

Comments
 (0)