Skip to content

Commit 6a4150e

Browse files
Merge pull request #2195 from NHSDigital/feature/ERSSUP-83710
Feature/erssup 83710
2 parents 1f42353 + f10c3a2 commit 6a4150e

File tree

13 files changed

+324
-12
lines changed

13 files changed

+324
-12
lines changed

proxies/live/apiproxy/policies/AssignMessage.AuthenticationOperationOutcomeErrorResponse.xml renamed to proxies/live/apiproxy/policies/AssignMessage.OperationOutcomeErrorResponse.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.AuthenticationOperationOutcomeErrorResponse">
1+
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.OperationOutcomeErrorResponse">
22
<Set>
3-
<StatusCode>401</StatusCode>
3+
<StatusCode>{status_code}</StatusCode>
44
<ReasonPhrase>Unauthorized</ReasonPhrase>
55
<Payload contentType="application/fhir+json" variablePrefix="%" variableSuffix="#">{ "resourceType": "OperationOutcome", "meta": { "lastUpdated": "%current_timestamp#", "profile" : [ "%op_outcome_fhir_profile#" ] }, "issue": [ { "severity": "error", "code": "%op_outcome_issue_code#", "details": { "coding": [ { "system": "%op_outcome_issue_details_coding_system#", "code": "%op_outcome_issue_details_coding_code#" } ] }, "diagnostics": "%faultstring#" } ] }</Payload>
66
</Set>

proxies/live/apiproxy/policies/AssignMessage.SetOperationOutcomeIssueCodeLogin.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<AssignMessage enabled="true" name="AssignMessage.SetOperationOutcomeIssueCodeLogin">
2+
<AssignVariable>
3+
<Name>status_code</Name>
4+
<Value>401</Value>
5+
</AssignVariable>
26
<AssignVariable>
37
<Name>op_outcome_issue_code</Name>
48
<Value>login</Value>

proxies/live/apiproxy/policies/AssignMessage.SetOperationOutcomeIssueIal.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<AssignMessage enabled="true" name="AssignMessage.SetOperationOutcomeIssueIal">
2+
<AssignVariable>
3+
<Name>status_code</Name>
4+
<Value>401</Value>
5+
</AssignVariable>
26
<AssignVariable>
37
<Name>op_outcome_issue_code</Name>
48
<Value>forbidden</Value>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<AssignMessage enabled="true" name="AssignMessage.SetOperationOutcomeMissingAsid">
2+
<AssignVariable>
3+
<Name>op_outcome_issue_code</Name>
4+
<Value>forbidden</Value>
5+
</AssignVariable>
6+
<AssignVariable>
7+
<Name>faultstring</Name>
8+
<Value>ASID is not configured in the application</Value>
9+
</AssignVariable>
10+
<AssignVariable>
11+
<Name>status_code</Name>
12+
<Value>403</Value>
13+
</AssignVariable>
14+
</AssignMessage>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<RaiseFault async="false" continueOnError="false" enabled="true" name="RaiseFault.MissingAsid">
2+
<FaultResponse>
3+
<Set>
4+
<Payload contentType="text/plain"/>
5+
<StatusCode>403</StatusCode>
6+
<ReasonPhrase>Forbidden</ReasonPhrase>
7+
</Set>
8+
</FaultResponse>
9+
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
10+
</RaiseFault>

proxies/live/apiproxy/targets/ers-target.xml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Name>AssignMessage.SetOperationOutcomeIssueCodeLogin</Name>
1616
</Step>
1717
<Step>
18-
<Name>AssignMessage.AuthenticationOperationOutcomeErrorResponse</Name>
18+
<Name>AssignMessage.OperationOutcomeErrorResponse</Name>
1919
</Step>
2020
<Condition>(oauthV2.OauthV2.VerifyAccessToken.failed = true) and (isFhirR4Path = true)</Condition>
2121
</FaultRule>
@@ -43,7 +43,7 @@
4343
<Condition>aalError != true</Condition>
4444
</Step>
4545
<Step>
46-
<Name>AssignMessage.AuthenticationOperationOutcomeErrorResponse</Name>
46+
<Name>AssignMessage.OperationOutcomeErrorResponse</Name>
4747
<Condition>aalError = true</Condition>
4848
</Step>
4949
<Condition>(oauthV2.OauthV2.VerifyAccessToken.failed = true) and (isFhirR4Path = false)</Condition>
@@ -85,10 +85,27 @@
8585
<Name>AssignMessage.SetOperationOutcomeIssueIal</Name>
8686
</Step>
8787
<Step>
88-
<Name>AssignMessage.AuthenticationOperationOutcomeErrorResponse</Name>
88+
<Name>AssignMessage.OperationOutcomeErrorResponse</Name>
8989
</Step>
9090
<Condition>(raisefault.RaiseFault.401InsufficientIal.failed = true)</Condition>
9191
</FaultRule>
92+
<FaultRule name="missing_asid">
93+
<Step>
94+
<Condition>(isFhirR4Path = true)</Condition>
95+
<Name>AssignMessage.SetOperationOutcomeVariablesR4</Name>
96+
</Step>
97+
<Step>
98+
<Condition>(isFhirR4Path = false)</Condition>
99+
<Name>AssignMessage.SetOperationOutcomeVariablesPreR4</Name>
100+
</Step>
101+
<Step>
102+
<Name>AssignMessage.SetOperationOutcomeMissingAsid</Name>
103+
</Step>
104+
<Step>
105+
<Name>AssignMessage.OperationOutcomeErrorResponse</Name>
106+
</Step>
107+
<Condition>(raisefault.RaiseFault.MissingAsid.failed = true)</Condition>
108+
</FaultRule>
92109
</FaultRules>
93110
<PreFlow>
94111
<Request>
@@ -101,6 +118,10 @@
101118
<Step>
102119
<Name>OauthV2.VerifyAccessToken</Name>
103120
</Step>
121+
<Step>
122+
<Name>RaiseFault.MissingAsid</Name>
123+
<Condition>(app.asid == null) Or (app.asid == "")</Condition>
124+
</Step>
104125
<Step>
105126
<Name>AssignMessage.PopulateAsidFromApp</Name>
106127
</Step>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"meta": {
3+
"profile": [
4+
"https://fhir.nhs.uk/STU3/StructureDefinition/eRS-OperationOutcome-1"
5+
]
6+
},
7+
"resourceType": "OperationOutcome",
8+
"issue": [
9+
{
10+
"severity": "error",
11+
"code": "login",
12+
"details": {
13+
"coding": [
14+
{
15+
"system": "https://fhir.nhs.uk/STU3/CodeSystem/eRS-APIErrorCode-1",
16+
"code": "NO_ACCESS"
17+
}
18+
]
19+
},
20+
"diagnostics": "Example diagnostics message."
21+
}
22+
]
23+
}

specification/components/r4/schemas/responses/Forbidden.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description: |
55
| issue.details.coding.code | issue.code | Coding System | Description |
66
| ------------------------- | ---------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
77
| REC_FORBIDDEN | forbidden | [BaRS Error Code](https://fhir.nhs.uk/CodeSystem/http-error-codes) | A call attempts to access or operate upon a resource without proper authorisation. |
8+
| ACCESS_DENIED | forbidden | [APIM Error Code](https://fhir.nhs.uk/CodeSystem/NHSD-API-ErrorOrWarningCode) | The request could not be authenticated due to insufficient credentials being provided. |
89
910
headers:
1011
X-Correlation-ID:
@@ -18,4 +19,4 @@ content:
1819
schema:
1920
$ref: '../NHSDigital-OperationOutcome.yaml'
2021
example:
21-
$ref: '../../examples/NHSDigital-OperationOutcome-403.json'
22+
$ref: '../../examples/NHSDigital-OperationOutcome-403.json'

specification/components/r4/schemas/responses/Unauthorized.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: |
44
55
| issue.details.coding.code | issue.code | Coding System | Description |
66
| ------------------------- | ---------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7-
| ACCESS_DENIED | login | [APIM Error Code](https://fhir.nhs.uk/CodeSystem/NHSD-API-ErrorOrWarningCode) | The request could not be authenticated due to either no credentials being provided or the provided credentials no longer being valid. Callers receiving this code should reauthenticate. |
7+
| ACCESS_DENIED | <ul><li>login</li><li>forbidden</li></ul> | [APIM Error Code](https://fhir.nhs.uk/CodeSystem/NHSD-API-ErrorOrWarningCode) | The request could not be authenticated due to either no credentials being provided or the provided credentials no longer being valid. Callers receiving this code should reauthenticate. |
88
headers:
99
X-Correlation-ID:
1010
$ref: '../headers/response/CorrelationID.yaml'
@@ -15,4 +15,4 @@ content:
1515
schema:
1616
$ref: '../NHSDigital-OperationOutcome.yaml'
1717
example:
18-
$ref: '../../examples/NHSDigital-OperationOutcome-401.json'
18+
$ref: '../../examples/NHSDigital-OperationOutcome-401.json'

specification/components/stu3/schemas/responses/Forbidden.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ description: |
22
Where status code 403 (Forbidden) is returned then an eRS-OperationOutcome-1 will be included in the body, as detailed below.
33
Check diagnostics property for specific information regarding the error.
44
5-
| Error code | Description |
6-
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
7-
| FORBIDDEN | Access Forbidden. |
5+
| issue.details.coding.code | issue.code | Coding System | Description |
6+
| ------------------------- | ---------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
7+
| FORBIDDEN | forbidden | [eRS Error Code](https://fhir.nhs.uk/CodeSystem/ers-error-codes) | A call attempts to access or operate upon a resource without proper authorisation. |
8+
| NO_ACCESS | forbidden | [eRS Error Code](https://fhir.nhs.uk/CodeSystem/ers-error-codes) | The request could not be authenticated due to insufficient credentials being provided. |
89
headers:
910
X-Correlation-ID:
1011
$ref: '../headers/response/CorrelationID.yaml'

0 commit comments

Comments
 (0)