Skip to content

Commit 59de4c8

Browse files
authored
Merge pull request #25 from NHSDigital/setup-target-endpoint
Set up target endpoint
2 parents c9acf47 + 57d8c25 commit 59de4c8

7 files changed

Lines changed: 26 additions & 41 deletions

File tree

azure/azure-pr-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ extends:
3232
service_name: ${{ variables.service_name }}
3333
short_service_name: ${{ variables.short_service_name }}
3434
service_base_path: ${{ variables.service_base_path }}
35+
jinja_templates:
36+
NHS_CONTENT_API_TARGET_SERVER: nhs-website-content-api
3537
apigee_deployments:
3638
- environment: internal-dev
3739
post_deploy:

azure/azure-release-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ extends:
3030
service_name: ${{ variables.service_name }}
3131
short_service_name: ${{ variables.short_service_name }}
3232
service_base_path: ${{ variables.service_base_path }}
33+
jinja_templates:
34+
NHS_CONTENT_API_TARGET_SERVER: nhs-website-content-api
3335
apigee_deployments:
3436
- environment: internal-dev
3537
post_deploy:

manifest_template.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ apigee:
7070
environments: [ {{ ENV.name }} ]
7171
proxies:
7272
- {{ NAME }}
73-
- identity-service-{{ ENV.name }}
74-
{% if ENV.has_mock_auth | default(false) %}
75-
- identity-service-mock-{{ ENV.name }}
76-
{% endif %}
77-
scopes:
78-
- 'urn:nhsd:apim:app:level3:{{ SERVICE_NAME }}'
79-
- 'urn:nhsd:apim:user-nhs-cis2:aal3:{{ SERVICE_NAME }}'
8073
specs:
8174
- name: {{ NAME }}
8275
path: {{ SERVICE_NAME }}.json

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

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

proxies/live/apiproxy/targets/target.xml

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,34 @@
22
<PreFlow>
33
<Request>
44
<Step>
5-
<Name>OauthV2.VerifyAccessTokenAppLevel3OrCis2Aal3</Name>
5+
<Name>VerifyAPIKey.FromHeader</Name>
66
</Step>
77
<Step>
88
<Name>FlowCallout.ApplyRateLimiting</Name>
99
</Step>
1010
</Request>
1111
</PreFlow>
1212
<FaultRules>
13-
<FaultRule name="access_token_expired">
14-
<Step>
15-
<Name>ExtractVariables.OAuthErrorFaultString</Name>
16-
</Step>
17-
<Step>
18-
<Name>AssignMessage.OAuthPolicyErrorResponse</Name>
19-
</Step>
20-
<Condition>oauthV2.OauthV2.VerifyAccessToken.failed</Condition>
13+
<FaultRule name="api_key_invalid">
14+
<Condition>verifyapikey.VerifyAPIKey.FromHeader.failed</Condition>
2115
</FaultRule>
2216
</FaultRules>
23-
<!--
24-
To point to a named target server as this is how it SHOULD be implemented:
25-
For example:
26-
<HTTPTargetConnection>
27-
<SSLInfo>
28-
<Enabled>true</Enabled>
29-
</SSLInfo>
30-
<LoadBalancer>
31-
<Server name="nhs-website-content-api" />
32-
</LoadBalancer>
33-
</HTTPTargetConnection>
34-
-->
3517
<HTTPTargetConnection>
36-
<URL>http://mocktarget.apigee.net</URL>
37-
<Properties>
38-
<Property name="supports.http10">true</Property>
39-
<Property name="request.retain.headers">User-Agent,Referer,Accept-Language</Property>
40-
<Property name="retain.queryparams">apikey</Property>
41-
</Properties>
18+
<SSLInfo>
19+
<Enabled>true</Enabled>
20+
</SSLInfo>
21+
<Path>/content-api</Path>
22+
<LoadBalancer>
23+
<Server name= "{{ NHS_CONTENT_API_TARGET_SERVER }}" />
24+
</LoadBalancer>
4225
</HTTPTargetConnection>
26+
27+
<!-- <HTTPTargetConnection>-->
28+
<!-- <URL>http://mocktarget.apigee.net</URL>-->
29+
<!-- <Properties>-->
30+
<!-- <Property name="supports.http10">true</Property>-->
31+
<!-- <Property name="request.retain.headers">User-Agent,Referer,Accept-Language</Property>-->
32+
<!-- <Property name="retain.queryparams">apikey</Property>-->
33+
<!-- </Properties>-->
34+
<!-- </HTTPTargetConnection>-->
4335
</TargetEndpoint>

proxies/sandbox/apiproxy/policies/OAuthV2.VerifyAccessToken.xml

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

tests/test_endpoints.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,21 @@ def test_wait_for_status(nhsd_apim_proxy_url, status_endpoint_auth_headers):
7575
assert deployed_commitId == getenv('SOURCE_COMMIT_ID')
7676

7777

78+
@pytest.mark.skip(reason="Temporarily disabled 16/11/2023")
7879
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level0"})
7980
def test_app_level0(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
8081
resp = requests.get(f"{nhsd_apim_proxy_url}", headers=nhsd_apim_auth_headers)
8182
assert resp.status_code == 401 # unauthorized
8283

8384

85+
@pytest.mark.skip(reason="Temporarily disabled 16/11/2023")
8486
@pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level3"})
8587
def test_app_level3(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
8688
resp = requests.get(f"{nhsd_apim_proxy_url}", headers=nhsd_apim_auth_headers)
8789
assert resp.status_code == 200
8890

8991

92+
@pytest.mark.skip(reason="Temporarily disabled 16/11/2023")
9093
@pytest.mark.nhsd_apim_authorization(
9194
{
9295
"access": "healthcare_worker",

0 commit comments

Comments
 (0)