Skip to content

Commit

Permalink
add s2s to url and security whitelist (#507)
Browse files Browse the repository at this point in the history
* add s2s to url and security whitelist

* fix checkstyle issue

---------

Co-authored-by: DeclanClarkeCGI <142809814+DeclanClarkeCGI@users.noreply.github.com>
  • Loading branch information
TomReed and DeclanClarkeCGI committed Aug 21, 2024
1 parent cdf54d8 commit 534d44a
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class SecurityConfig {
"/internal-user/logout",
"/internal-user/handle-oauth-code",
"/api/testing-support/**",
"/api/s2s/**",
"/"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -36,53 +36,53 @@ public ResponseEntity<OpalS2SResponseWrapper> searchDebtorProfile(OpalS2SRequest
xmlns:lgsm="http://www.justice.gov.uk/magistrates/atcm/SearchMetadataType">
<lgsr:SearchResponseType>
<lgsm:SearchMetadataType>
<SequenceNumber>123</SequenceNumber>
<CPPDefendantID>DEF123</CPPDefendantID>
<CPPCaseID>CASE123</CPPCaseID>
<CourtOUCode>COURT01</CourtOUCode>
<DateOfHearing>2023-10-01</DateOfHearing>
<TimeOfHearing>10:00</TimeOfHearing>
<SequenceNumber xmlns="">123</SequenceNumber>
<CPPDefendantID xmlns="">DEF123</CPPDefendantID>
<CPPCaseID xmlns="">CASE123</CPPCaseID>
<CourtOUCode xmlns="">COURT01</CourtOUCode>
<DateOfHearing xmlns="">2023-10-01</DateOfHearing>
<TimeOfHearing xmlns="">10:00</TimeOfHearing>
</lgsm:SearchMetadataType>
<AccountMatch>
<Matches>
<Account>
<OrganisationName>Sample Org</OrganisationName>
<Forenames>John</Forenames>
<Surname>Doe</Surname>
<DOB>1980-01-01</DOB>
<NationalInsuranceNumber>AB123456C</NationalInsuranceNumber>
<AccountNumber>12345678</AccountNumber>
<AddressLine1>123 Sample Street</AddressLine1>
<AddressLine2>Sample Area</AddressLine2>
<AddressLine3>Sample City</AddressLine3>
<Postcode>AB12 3CD</Postcode>
<LastEnforcementAction>None</LastEnforcementAction>
<BalanceOutstanding>1000.00</BalanceOutstanding>
<CollectionOrderMade>Y</CollectionOrderMade>
<PaymentTerms>Monthly</PaymentTerms>
<AmountImposed>1500.00</AmountImposed>
<AmountPaid>500.00</AmountPaid>
<DaysInDefault>30</DaysInDefault>
<MasterAccount>N</MasterAccount>
<OriginatingCT>CT123</OriginatingCT>
<ParentGuardianFlag>N</ParentGuardianFlag>
<ProsecutorCaseReference>REF123</ProsecutorCaseReference>
<AccountMatch xmlns="">
<Matches xmlns="">
<Account xmlns="">
<OrganisationName xmlns="">Sample Org</OrganisationName>
<Forenames xmlns="">John</Forenames>
<Surname xmlns="">Doe</Surname>
<DOB xmlns="">1980-01-01</DOB>
<NationalInsuranceNumber xmlns="">AB123456C</NationalInsuranceNumber>
<AccountNumber xmlns="">12345678</AccountNumber>
<AddressLine1 xmlns="">123 Sample Street</AddressLine1>
<AddressLine2 xmlns="">Sample Area</AddressLine2>
<AddressLine3 xmlns="">Sample City</AddressLine3>
<Postcode xmlns="">AB12 3CD</Postcode>
<LastEnforcementAction xmlns="">None</LastEnforcementAction>
<BalanceOutstanding xmlns="">1000.00</BalanceOutstanding>
<CollectionOrderMade xmlns="">Y</CollectionOrderMade>
<PaymentTerms xmlns="">Monthly</PaymentTerms>
<AmountImposed xmlns="">1500.00</AmountImposed>
<AmountPaid xmlns="">500.00</AmountPaid>
<DaysInDefault xmlns="">30</DaysInDefault>
<MasterAccount xmlns="">N</MasterAccount>
<OriginatingCT xmlns="">CT123</OriginatingCT>
<ParentGuardianFlag xmlns="">N</ParentGuardianFlag>
<ProsecutorCaseReference xmlns="">REF123</ProsecutorCaseReference>
</Account>
</Matches>
</AccountMatch>
</lgsr:SearchResponseType>
<UnprocessedRequests>
<UnprocessedRequests xmlns="">
<lgsm:SearchMetadataType>
<SequenceNumber>456</SequenceNumber>
<CPPDefendantID>DEF456</CPPDefendantID>
<CPPCaseID>CASE456</CPPCaseID>
<CourtOUCode>COURT02</CourtOUCode>
<DateOfHearing>2023-11-01</DateOfHearing>
<TimeOfHearing>11:00</TimeOfHearing>
<SequenceNumber xmlns="">456</SequenceNumber>
<CPPDefendantID xmlns="">DEF456</CPPDefendantID>
<CPPCaseID xmlns="">CASE456</CPPCaseID>
<CourtOUCode xmlns="">COURT02</CourtOUCode>
<DateOfHearing xmlns="">2023-11-01</DateOfHearing>
<TimeOfHearing xmlns="">11:00</TimeOfHearing>
</lgsm:SearchMetadataType>
</UnprocessedRequests>
<ErrorCode>12345</ErrorCode>
<ErrorMessage>Sample error message</ErrorMessage>
<ErrorCode xmlns="">12345</ErrorCode>
<ErrorMessage xmlns="">Sample error message</ErrorMessage>
</DebtorProfileResponse>
""";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,64 +19,63 @@ void testSearchDebtorProfile_Success() {
OpalS2SRequestWrapper request = new OpalS2SRequestWrapper();
OpalS2SResponseWrapper response = OpalS2SResponseWrapper.builder()
.opalResponsePayload("""
<?xml version="1.0" encoding="UTF-8"?>
<DebtorProfileResponse xmlns="http://www.justice.gov.uk/magistrates/atcm/DebtorProfileResponse"
xmlns:lgsr="http://www.justice.gov.uk/magistrates/atcm/SearchResponseType"
xmlns:lgsm="http://www.justice.gov.uk/magistrates/atcm/SearchMetadataType">
<lgsr:SearchResponseType>
<lgsm:SearchMetadataType>
<SequenceNumber>123</SequenceNumber>
<CPPDefendantID>DEF123</CPPDefendantID>
<CPPCaseID>CASE123</CPPCaseID>
<CourtOUCode>COURT01</CourtOUCode>
<DateOfHearing>2023-10-01</DateOfHearing>
<TimeOfHearing>10:00</TimeOfHearing>
</lgsm:SearchMetadataType>
<AccountMatch>
<Matches>
<Account>
<OrganisationName>Sample Org</OrganisationName>
<Forenames>John</Forenames>
<Surname>Doe</Surname>
<DOB>1980-01-01</DOB>
<NationalInsuranceNumber>AB123456C</NationalInsuranceNumber>
<AccountNumber>12345678</AccountNumber>
<AddressLine1>123 Sample Street</AddressLine1>
<AddressLine2>Sample Area</AddressLine2>
<AddressLine3>Sample City</AddressLine3>
<Postcode>AB12 3CD</Postcode>
<LastEnforcementAction>None</LastEnforcementAction>
<BalanceOutstanding>1000.00</BalanceOutstanding>
<CollectionOrderMade>Y</CollectionOrderMade>
<PaymentTerms>Monthly</PaymentTerms>
<AmountImposed>1500.00</AmountImposed>
<AmountPaid>500.00</AmountPaid>
<DaysInDefault>30</DaysInDefault>
<MasterAccount>N</MasterAccount>
<OriginatingCT>CT123</OriginatingCT>
<ParentGuardianFlag>N</ParentGuardianFlag>
<ProsecutorCaseReference>REF123</ProsecutorCaseReference>
</Account>
</Matches>
</AccountMatch>
</lgsr:SearchResponseType>
<UnprocessedRequests>
<lgsm:SearchMetadataType>
<SequenceNumber>456</SequenceNumber>
<CPPDefendantID>DEF456</CPPDefendantID>
<CPPCaseID>CASE456</CPPCaseID>
<CourtOUCode>COURT02</CourtOUCode>
<DateOfHearing>2023-11-01</DateOfHearing>
<TimeOfHearing>11:00</TimeOfHearing>
</lgsm:SearchMetadataType>
</UnprocessedRequests>
<ErrorCode>12345</ErrorCode>
<ErrorMessage>Sample error message</ErrorMessage>
</DebtorProfileResponse>
""")
<?xml version="1.0" encoding="UTF-8"?>
<DebtorProfileResponse xmlns="http://www.justice.gov.uk/magistrates/atcm/DebtorProfileResponse"
xmlns:lgsr="http://www.justice.gov.uk/magistrates/atcm/SearchResponseType"
xmlns:lgsm="http://www.justice.gov.uk/magistrates/atcm/SearchMetadataType">
<lgsr:SearchResponseType>
<lgsm:SearchMetadataType>
<SequenceNumber xmlns="">123</SequenceNumber>
<CPPDefendantID xmlns="">DEF123</CPPDefendantID>
<CPPCaseID xmlns="">CASE123</CPPCaseID>
<CourtOUCode xmlns="">COURT01</CourtOUCode>
<DateOfHearing xmlns="">2023-10-01</DateOfHearing>
<TimeOfHearing xmlns="">10:00</TimeOfHearing>
</lgsm:SearchMetadataType>
<AccountMatch xmlns="">
<Matches xmlns="">
<Account xmlns="">
<OrganisationName xmlns="">Sample Org</OrganisationName>
<Forenames xmlns="">John</Forenames>
<Surname xmlns="">Doe</Surname>
<DOB xmlns="">1980-01-01</DOB>
<NationalInsuranceNumber xmlns="">AB123456C</NationalInsuranceNumber>
<AccountNumber xmlns="">12345678</AccountNumber>
<AddressLine1 xmlns="">123 Sample Street</AddressLine1>
<AddressLine2 xmlns="">Sample Area</AddressLine2>
<AddressLine3 xmlns="">Sample City</AddressLine3>
<Postcode xmlns="">AB12 3CD</Postcode>
<LastEnforcementAction xmlns="">None</LastEnforcementAction>
<BalanceOutstanding xmlns="">1000.00</BalanceOutstanding>
<CollectionOrderMade xmlns="">Y</CollectionOrderMade>
<PaymentTerms xmlns="">Monthly</PaymentTerms>
<AmountImposed xmlns="">1500.00</AmountImposed>
<AmountPaid xmlns="">500.00</AmountPaid>
<DaysInDefault xmlns="">30</DaysInDefault>
<MasterAccount xmlns="">N</MasterAccount>
<OriginatingCT xmlns="">CT123</OriginatingCT>
<ParentGuardianFlag xmlns="">N</ParentGuardianFlag>
<ProsecutorCaseReference xmlns="">REF123</ProsecutorCaseReference>
</Account>
</Matches>
</AccountMatch>
</lgsr:SearchResponseType>
<UnprocessedRequests xmlns="">
<lgsm:SearchMetadataType>
<SequenceNumber xmlns="">456</SequenceNumber>
<CPPDefendantID xmlns="">DEF456</CPPDefendantID>
<CPPCaseID xmlns="">CASE456</CPPCaseID>
<CourtOUCode xmlns="">COURT02</CourtOUCode>
<DateOfHearing xmlns="">2023-11-01</DateOfHearing>
<TimeOfHearing xmlns="">11:00</TimeOfHearing>
</lgsm:SearchMetadataType>
</UnprocessedRequests>
<ErrorCode xmlns="">12345</ErrorCode>
<ErrorMessage xmlns="">Sample error message</ErrorMessage>
</DebtorProfileResponse>
""")
.build();

ResponseEntity<OpalS2SResponseWrapper> responseEntity = new ResponseEntity<>(response, HttpStatus.OK);

// Act
ResponseEntity<OpalS2SResponseWrapper> actualResponse = debtorProfileSearchController
Expand Down

0 comments on commit 534d44a

Please sign in to comment.