From d95b7711db8ba266bdcbff9676e2947ee393d813 Mon Sep 17 00:00:00 2001 From: jack-mccabe-defra Date: Tue, 29 Oct 2024 10:35:16 +0000 Subject: [PATCH 1/3] add LOG_LEVEL to prd1 and dev1 + add test scripts --- appConfig/appConfig.dev1.yaml | 2 ++ appConfig/appConfig.prd1.yaml | 2 ++ test_scripts/apim-test.sh | 40 ++++++++++++++++++++++++++++ test_scripts/dal-test.sh | 44 +++++++++++++++++++++++++++++++ test_scripts/kits-gateway-test.sh | 25 ++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 test_scripts/apim-test.sh create mode 100644 test_scripts/dal-test.sh create mode 100644 test_scripts/kits-gateway-test.sh diff --git a/appConfig/appConfig.dev1.yaml b/appConfig/appConfig.dev1.yaml index 02486ce4..86e67703 100644 --- a/appConfig/appConfig.dev1.yaml +++ b/appConfig/appConfig.dev1.yaml @@ -12,6 +12,8 @@ value: "dev1" - key: HEALTH_CHECK_ENABLED value: "false" +- key: LOG_LEVEL + value: "http" # Secrets - key: API_TENANT_ID diff --git a/appConfig/appConfig.prd1.yaml b/appConfig/appConfig.prd1.yaml index eba6ad79..e24e34c6 100644 --- a/appConfig/appConfig.prd1.yaml +++ b/appConfig/appConfig.prd1.yaml @@ -12,6 +12,8 @@ value: "prd1" - key: HEALTH_CHECK_ENABLED value: "true" +- key: LOG_LEVEL + value: "http" # Secrets - key: API_TENANT_ID diff --git a/test_scripts/apim-test.sh b/test_scripts/apim-test.sh new file mode 100644 index 00000000..81c1259a --- /dev/null +++ b/test_scripts/apim-test.sh @@ -0,0 +1,40 @@ +# Generate token +token_request=$(curl --location "https://login.microsoftonline.com/${apim_tenant_id}/oauth2/v2.0/token" \ +--header 'content-type: application/x-www-form-urlencoded' \ +--data-urlencode 'grant_type=client_credentials' \ +--data-urlencode "scope=${apim_scope}" \ +-u "${apim_client_id}:${apim_client_secret}") + +token=$(jq -r '.access_token' <<< "${token_request}") +echo "Token: ${token}" + + +curl --location "https://${apim_url}/person/search" \ +--header "email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--data '{ + "offset": 0, + "limit": 20, + "searchFieldType": "CUSTOMER_REFERENCE", + "primarySearchPhrase": "1103020285", + "secondarySearchPhrase": null +}' \ +--header "Authorization: Bearer ${token}" \ +--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" + +curl --location "https://${apim_url}/organisation/search" \ +--header "email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \ +--header "Authorization: Bearer ${token}" \ +--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" + +curl --location "https://${apim_url}/authorisation/organisation/${org_id}" \ +--header "email: ${user_email}" \ +--header "Authorization: Bearer ${token}" \ +--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" + +curl --location "https://${apim_url}/organisation/person/${person_id}/summary?search=" \ +--header "email: ${user_email}" \ +--header "Authorization: Bearer ${token}" \ +--header "Ocp-Apim-Subscription-Key: ${apim_subscription_key}" diff --git a/test_scripts/dal-test.sh b/test_scripts/dal-test.sh new file mode 100644 index 00000000..47799d8d --- /dev/null +++ b/test_scripts/dal-test.sh @@ -0,0 +1,44 @@ +# Generate token +token_request=$(curl --location "https://login.microsoftonline.com/${dal_tenant_id}/oauth2/v2.0/token" \ +--header 'content-type: application/x-www-form-urlencoded' \ +--data-urlencode 'grant_type=client_credentials' \ +--data-urlencode "scope=${dal_scope}" \ +-u "${dal_client_id}:${dal_client_secret}") + +token=$(jq -r '.access_token' <<< "${token_request}") +echo "Token: ${token}" + + +# Authenticate questions +curl --location "${dal_url}" \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer ${token}" \ +--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n crn\n authenticationQuestions(entraIdUserObjectId: \"e99e8cec-6b83-4de8-b9d1-cccfeeb82dbc\") {\n isFound\n updatedAt\n memorableDate\n memorableEvent\n memorablePlace\n }\n }\n}","variables":{"crn":"1103020285"}}' + +# Customer businesses +curl --location "${dal_url}" \ +--header "Email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer ${token}" \ +--data '{"query":"query Customer ($crn: ID!) {\n customer(crn: $crn) {\n personId\n crn\n businesses {\n sbi\n name\n }\n }\n}","variables":{"crn":"1103020285"}}' + +# Customer permissions +curl --location "${dal_url}" \ +--header "Email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer ${token}" \ +--data '{"query":"query Customer ($crn: ID!, $sbi: ID!) {\n customer(crn: $crn) {\n crn\n business(sbi: $sbi) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"crn":"1103020285","sbi":"106833558"}}' + +# Business customers +curl --location 'https://fcp-data-access-layer-api.tst1.adp.defra.gov.uk/graphql' \ +--header "Email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer ${token}" \ +--data '{"query":"query BusinessCustomers ($sbi: ID!) {\n business(sbi: $sbi) {\n customers {\n firstName\n lastName\n crn\n }\n }\n}","variables":{"sbi":"107591843"}}' + +# Business customer permissions +curl --location "${dal_url}" \ +--header "Email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--header "Authorization: Bearer ${token}" \ +--data '{"query":"query BusinessCustomer ($sbi: ID!, $crn: ID!) {\n business(sbi: $sbi) {\n customer(crn: $crn) {\n role\n permissionGroups {\n level\n id\n }\n }\n }\n}","variables":{"sbi":"107591843","crn":"1100071369"}}' \ No newline at end of file diff --git a/test_scripts/kits-gateway-test.sh b/test_scripts/kits-gateway-test.sh new file mode 100644 index 00000000..62fab357 --- /dev/null +++ b/test_scripts/kits-gateway-test.sh @@ -0,0 +1,25 @@ +curl --location "https://${gateway_url}:8444/extapi/person/search" \ +--header "email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--data '{ + "offset": 0, + "limit": 20, + "searchFieldType": "CUSTOMER_REFERENCE", + "primarySearchPhrase": "1103020285", + "secondarySearchPhrase": null +}' \ +--cert ${cert_location} --key ${key_location} + +curl --location "https://${gateway_url}:8444/extapi/organisation/search" \ +--header "email: ${user_email}" \ +--header 'Content-Type: application/json' \ +--data '{"offset":0,"limit": 20, "searchFieldType":"SBI","primarySearchPhrase":"106327021"}' \ +--cert ${cert_location} --key ${key_location} + +curl --location "https://${gateway_url}:8444/extapi/authorisation/organisation/${org_id}" \ +--header "email: ${user_email}" \ +--cert ${cert_location} --key ${key_location} + +curl --location "https://${gateway_url}:8444/extapi/organisation/person/${person_id}/summary?search=" \ +--header "email: ${user_email}" \ +--cert ${cert_location} --key ${key_location} From a367e07667704bee1f9e18f9f3ffe63649145fbe Mon Sep 17 00:00:00 2001 From: jack-mccabe-defra Date: Tue, 29 Oct 2024 10:35:27 +0000 Subject: [PATCH 2/3] 1.3.25 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a1313da..d54a11bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fcp-data-access-layer-api", - "version": "1.3.24", + "version": "1.3.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fcp-data-access-layer-api", - "version": "1.3.24", + "version": "1.3.25", "license": "OGL-UK-3.0", "dependencies": { "@apollo/datasource-rest": "^6.2.2", diff --git a/package.json b/package.json index df55442c..bc2beb66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fcp-data-access-layer-api", - "version": "1.3.24", + "version": "1.3.25", "description": "Customer Registry GraphQL Service", "homepage": "https://github.com/DEFRA/fcp-data-access-layer-api", "main": "app/index.js", From 2884c19e0a725733051ca7a95f32002e0f2772bd Mon Sep 17 00:00:00 2001 From: jack-mccabe-defra Date: Tue, 29 Oct 2024 10:35:32 +0000 Subject: [PATCH 3/3] 1.3.26 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d54a11bf..2a1c2904 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fcp-data-access-layer-api", - "version": "1.3.25", + "version": "1.3.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fcp-data-access-layer-api", - "version": "1.3.25", + "version": "1.3.26", "license": "OGL-UK-3.0", "dependencies": { "@apollo/datasource-rest": "^6.2.2", diff --git a/package.json b/package.json index bc2beb66..9acf31b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fcp-data-access-layer-api", - "version": "1.3.25", + "version": "1.3.26", "description": "Customer Registry GraphQL Service", "homepage": "https://github.com/DEFRA/fcp-data-access-layer-api", "main": "app/index.js",