From 534d44a3871b0bf8c2ba84857bea76f5fb5db5a8 Mon Sep 17 00:00:00 2001 From: Tom Reed Date: Wed, 21 Aug 2024 15:41:51 +0100 Subject: [PATCH] add s2s to url and security whitelist (#507) * add s2s to url and security whitelist * fix checkstyle issue --------- Co-authored-by: DeclanClarkeCGI <142809814+DeclanClarkeCGI@users.noreply.github.com> --- .../authentication/config/SecurityConfig.java | 1 + .../CreateFineAccountsController.java | 2 +- .../DebtorProfileSearchController.java | 80 ++++++------- .../DebtorProfileSearchControllerTest.java | 111 +++++++++--------- 4 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/opal/authentication/config/SecurityConfig.java b/src/main/java/uk/gov/hmcts/opal/authentication/config/SecurityConfig.java index 528680875..637088818 100644 --- a/src/main/java/uk/gov/hmcts/opal/authentication/config/SecurityConfig.java +++ b/src/main/java/uk/gov/hmcts/opal/authentication/config/SecurityConfig.java @@ -64,6 +64,7 @@ public class SecurityConfig { "/internal-user/logout", "/internal-user/handle-oauth-code", "/api/testing-support/**", + "/api/s2s/**", "/" }; diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/CreateFineAccountsController.java b/src/main/java/uk/gov/hmcts/opal/controllers/CreateFineAccountsController.java index 83f85e1ee..8b5ba3678 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/CreateFineAccountsController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/CreateFineAccountsController.java @@ -13,7 +13,7 @@ import uk.gov.hmcts.opal.dto.OpalS2SResponseWrapper; @RestController -@RequestMapping("/api/create-fine-accounts") +@RequestMapping("/api/s2s/create-fine-accounts") @Slf4j(topic = "CreateFineAccountController") @Tag(name = "Create Fine Account Controller") public class CreateFineAccountsController { diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchController.java b/src/main/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchController.java index 4550488ba..685eb2970 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchController.java @@ -13,7 +13,7 @@ import uk.gov.hmcts.opal.dto.OpalS2SResponseWrapper; @RestController -@RequestMapping("/api/debtor-profile") +@RequestMapping("/api/s2s/debtor-profile") @Slf4j(topic = "DebtorProfileSearchController") @Tag(name = "Debtor Profile Search Controller") public class DebtorProfileSearchController { @@ -36,53 +36,53 @@ public ResponseEntity searchDebtorProfile(OpalS2SRequest xmlns:lgsm="http://www.justice.gov.uk/magistrates/atcm/SearchMetadataType"> - 123 - DEF123 - CASE123 - COURT01 - 2023-10-01 - 10:00 + 123 + DEF123 + CASE123 + COURT01 + 2023-10-01 + 10:00 - - - - Sample Org - John - Doe - 1980-01-01 - AB123456C - 12345678 - 123 Sample Street - Sample Area - Sample City - AB12 3CD - None - 1000.00 - Y - Monthly - 1500.00 - 500.00 - 30 - N - CT123 - N - REF123 + + + + Sample Org + John + Doe + 1980-01-01 + AB123456C + 12345678 + 123 Sample Street + Sample Area + Sample City + AB12 3CD + None + 1000.00 + Y + Monthly + 1500.00 + 500.00 + 30 + N + CT123 + N + REF123 - + - 456 - DEF456 - CASE456 - COURT02 - 2023-11-01 - 11:00 + 456 + DEF456 + CASE456 + COURT02 + 2023-11-01 + 11:00 - 12345 - Sample error message + 12345 + Sample error message """; diff --git a/src/test/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchControllerTest.java b/src/test/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchControllerTest.java index 0b6c9c107..51c4f947c 100644 --- a/src/test/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchControllerTest.java +++ b/src/test/java/uk/gov/hmcts/opal/controllers/DebtorProfileSearchControllerTest.java @@ -19,64 +19,63 @@ void testSearchDebtorProfile_Success() { OpalS2SRequestWrapper request = new OpalS2SRequestWrapper(); OpalS2SResponseWrapper response = OpalS2SResponseWrapper.builder() .opalResponsePayload(""" - - - - - 123 - DEF123 - CASE123 - COURT01 - 2023-10-01 - 10:00 - - - - - Sample Org - John - Doe - 1980-01-01 - AB123456C - 12345678 - 123 Sample Street - Sample Area - Sample City - AB12 3CD - None - 1000.00 - Y - Monthly - 1500.00 - 500.00 - 30 - N - CT123 - N - REF123 - - - - - - - 456 - DEF456 - CASE456 - COURT02 - 2023-11-01 - 11:00 - - - 12345 - Sample error message - - """) + + + + + 123 + DEF123 + CASE123 + COURT01 + 2023-10-01 + 10:00 + + + + + Sample Org + John + Doe + 1980-01-01 + AB123456C + 12345678 + 123 Sample Street + Sample Area + Sample City + AB12 3CD + None + 1000.00 + Y + Monthly + 1500.00 + 500.00 + 30 + N + CT123 + N + REF123 + + + + + + + 456 + DEF456 + CASE456 + COURT02 + 2023-11-01 + 11:00 + + + 12345 + Sample error message + + """) .build(); - ResponseEntity responseEntity = new ResponseEntity<>(response, HttpStatus.OK); // Act ResponseEntity actualResponse = debtorProfileSearchController