Skip to content

Commit

Permalink
CME-121 ITHC update from master (#2387)
Browse files Browse the repository at this point in the history
* CME-121 Database monitoring and alerting on AM repositories - Unsync ITHC (#2379)

* DTSAM-611 Fix RAS FTA issue with XUI S2S token (#2385)

[DTSAM-611](https://tools.hmcts.net/jira/browse/DTSAM-611)

Refactor S2S token secrets and environment variables used in FTAs.

* DTSAM-571 Audit byPassOrgDroolRule when receiving ORG roles from ORM (#2364)

* DTSAM-571 Audit byPassOrgDroolRule when receiving ORG roles from ORM

* process included in log

* () added to log properties

* do not log if client id = am_org_role_mapping_service

* not ORM log filter fixed by using .equals()

* logging made null safe

* FTAs with ref S-*_Org_Role_Creation added ORM request header to remove from the KQL report

* ServiceAuthorization header moved to Test_Data_Base file

* ServiceAuthorization header added to requests in common dir

* DTSAM-572 Audit use of case-allocator rules for CCD case-roles (#2365)

* DTSAM-571 Audit byPassOrgDroolRule when receiving ORG roles from ORM

* process included in log

* () added to log properties

* do not log if client id = am_org_role_mapping_service

* not ORM log filter fixed by using .equals()

* DTSAM-572 Audit use of case-allocator rules for CCD case-roles - conditional logInfoMsg() added

* temp removal of conditional for report dev in aat

* temp removal of conditional for report dev in aat

* space added to log

* logging made null safe

* RoleCategory filter uncommented

* logging made null safe

* FTAs with ref S-*_Org_Role_Creation added ORM request header to remove from the KQL report

* ServiceAuthorization header moved to Test_Data_Base file

* ServiceAuthorization header added to requests in common dir

* logged rule corrected to case_allocator_approve_delete_case_role_all_wa_services

* RoleCategory comparisons made null safe

* Renovate Combined Pull Request (#2382)

* Update dependency org.pitest:pitest to v1.17.1

* Update versions.tomcat to v9.0.97

* DTSAM-610 Renovate review W/C 2024-11-18 - pitest reverted 1.17.1 -> 1.17.0

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Brown <michael.brown@hmcts.net>
Co-authored-by: mikebrownccd <104495891+mikebrownccd@users.noreply.github.com>

---------

Co-authored-by: mikebrownccd <104495891+mikebrownccd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Brown <michael.brown@hmcts.net>
  • Loading branch information
6 people authored Nov 21, 2024
1 parent a29f708 commit bf6646f
Show file tree
Hide file tree
Showing 29 changed files with 197 additions and 83 deletions.
15 changes: 7 additions & 8 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def secrets = [
's2s-${env}': [
secret('microservicekey-am-role-assignment-service', 'AM_ROLE_ASSIGNMENT_SERVICE_SECRET'),
secret('microservicekey-am-role-assignment-service', 'BEFTA_S2S_CLIENT_SECRET'),
secret('microservicekey-am-org-role-mapping-service', 'AM_ORG_S2S_SECRET')
secret('microservicekey-am-org-role-mapping-service', 'BEFTA_S2S_CLIENT_SECRET_OF_AM_ORG_ROLE_MAPPING_SERVICE'),
secret('microservicekey-ccd-data', 'BEFTA_S2S_CLIENT_SECRET_OF_CCD_DATA'),
secret('microservicekey-xui-webapp', 'BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP')
],
'am-${env}': [
secret('role-assignment-service-IDAM-CLIENT-SECRET', 'ROLE_ASSIGNMENT_IDAM_CLIENT_SECRET'),
Expand All @@ -44,17 +46,11 @@ def secrets = [
secret('test-am-user2-befta-pwd', 'TEST_AM_USER2_BEFTA_PWD'),
secret('test-am-user3-befta-pwd', 'TEST_AM_USER3_BEFTA_PWD'),
secret('role-assignment-service-IDAM-CLIENT-SECRET', 'OAUTH2_CLIENT_SECRET')
],
'ccd-${env}': [
secret('ccd-data-s2s-secret', 'CCD_DATA_S2S_SECRET')
],
'rpx-${env}': [
secret('xui-webapp', 'XUI_WEBAPP_S2S_SECRET')
]
]

// Configure branches to sync with master branch
def branchesToSync = ['demo', 'perftest', 'ithc']
def branchesToSync = ['demo', 'perftest']

// Vars needed for functional and smoke tests to run against AKS
env.IDAM_URL = "https://idam-api.aat.platform.hmcts.net"
Expand All @@ -64,6 +60,9 @@ env.DEFINITION_STORE_HOST = "http://ccd-definition-store-api-aat.service.core-co
env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal"
env.CCD_DATA_STORE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal"
env.BEFTA_S2S_CLIENT_ID = "am_role_assignment_service"
env.BEFTA_S2S_CLIENT_ID_OF_AM_ORG_ROLE_MAPPING_SERVICE = "am_org_role_mapping_service"
env.BEFTA_S2S_CLIENT_ID_OF_CCD_DATA = "ccd_data"
env.BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP = "xui_webapp"
env.OAUTH2_CLIENT_ID = "am_role_assignment"
env.OAUTH2_REDIRECT_URI = "http://am-role-assignment-service-aat.service.core-compute-aat.internal/oauth2redirect"
env.OAUTH2_ACCESS_TOKEN_TYPE = "OIDC"
Expand Down
14 changes: 7 additions & 7 deletions Jenkinsfile_nightly
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ def component = "role-assignment-service"

def secrets = [
's2s-${env}': [
secret('microservicekey-am-role-assignment-service', 'AM_ROLE_ASSIGNMENT_SERVICE_SECRET'),
secret('microservicekey-am-role-assignment-service', 'BEFTA_S2S_CLIENT_SECRET'),
secret('microservicekey-am-role-assignment-service', 'S2S_SECRET'),
secret('microservicekey-am-org-role-mapping-service', 'AM_ORG_S2S_SECRET')
secret('microservicekey-am-org-role-mapping-service', 'BEFTA_S2S_CLIENT_SECRET_OF_AM_ORG_ROLE_MAPPING_SERVICE'),
secret('microservicekey-ccd-data', 'BEFTA_S2S_CLIENT_SECRET_OF_CCD_DATA'),
secret('microservicekey-xui-webapp', 'BEFTA_S2S_CLIENT_SECRET_OF_XUI_WEBAPP')
],
'am-${env}': [
secret('role-assignment-service-IDAM-CLIENT-SECRET', 'ROLE_ASSIGNMENT_IDAM_CLIENT_SECRET'),
Expand All @@ -30,12 +33,6 @@ def secrets = [
secret('test-am-user2-befta-pwd', 'TEST_AM_USER2_BEFTA_PWD'),
secret('test-am-user3-befta-pwd', 'TEST_AM_USER3_BEFTA_PWD'),
secret('role-assignment-service-IDAM-CLIENT-SECRET', 'OAUTH2_CLIENT_SECRET')
],
'ccd-${env}': [
secret('ccd-data-s2s-secret', 'CCD_DATA_S2S_SECRET')
],
'rpx-${env}': [
secret('xui-webapp', 'XUI_WEBAPP_S2S_SECRET')
]
]

Expand Down Expand Up @@ -70,6 +67,9 @@ withNightlyPipeline(type, product, component) {
env.S2S_URL = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.S2S_URL_BASE = "http://rpe-service-auth-provider-aat.service.core-compute-aat.internal"
env.BEFTA_S2S_CLIENT_ID = "am_role_assignment_service"
env.BEFTA_S2S_CLIENT_ID_OF_AM_ORG_ROLE_MAPPING_SERVICE = "am_org_role_mapping_service"
env.BEFTA_S2S_CLIENT_ID_OF_CCD_DATA = "ccd_data"
env.BEFTA_S2S_CLIENT_ID_OF_XUI_WEBAPP = "xui_webapp"
env.DEFINITION_STORE_HOST = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal"
env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal"
env.CCD_DATA_STORE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def versions = [
springSecurity : '5.7.11',
springHystrix : '2.1.1.RELEASE',
swagger2Version: '2.10.5',
tomcat : '9.0.96',
tomcat : '9.0.97',
pact_version : '4.1.7',
rest_assured : '3.3.0',
cucumber : '5.7.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import lombok.extern.slf4j.Slf4j;
import uk.gov.hmcts.befta.DefaultTestAutomationAdapter;
import uk.gov.hmcts.befta.player.BackEndFunctionalTestScenarioContext;
import uk.gov.hmcts.reform.roleassignment.befta.utils.TokenUtils;
import uk.gov.hmcts.reform.roleassignment.befta.utils.UserTokenProviderConfig;
import uk.gov.hmcts.reform.roleassignment.util.EnvironmentVariableUtils;

import java.time.LocalDate;
import java.util.Date;
Expand All @@ -17,25 +14,16 @@ public class RoleAssignmentTestAutomationAdapter extends DefaultTestAutomationAd

@Override
public Object calculateCustomValue(BackEndFunctionalTestScenarioContext scenarioContext, Object key) {
//the docAMUrl is is referring the self link in PR
switch (key.toString()) {
case ("generateUUID"):
return UUID.randomUUID();
case ("generateCaseId"):
return generateCaseId();
case ("generateS2STokenForCcd"):
return new TokenUtils().generateServiceToken(buildCcdSpecificConfig());
case ("generateS2STokenForXui"):
return new TokenUtils().generateServiceToken(buildXuiSpecificConfig());
case ("generateS2STokenForOrm"):
return new TokenUtils().generateServiceToken(buildOrmSpecificConfig());
case ("tomorrow"):
return LocalDate.now().plusDays(1);
case ("today"):
return LocalDate.now();
default:
return super.calculateCustomValue(scenarioContext, key);
}
return switch (key.toString()) {
case ("generateUUID") -> UUID.randomUUID();
case ("generateCaseId") -> generateCaseId();
case ("generateS2STokenForCcd") -> super.getNewS2SToken("ccd_data");
case ("generateS2STokenForOrm") -> super.getNewS2SToken("am_org_role_mapping_service");
case ("generateS2STokenForXui") -> super.getNewS2SToken("xui_webapp");
case ("tomorrow") -> LocalDate.now().plusDays(1);
case ("today") -> LocalDate.now();
default -> super.calculateCustomValue(scenarioContext, key);
};
}

private Object generateCaseId() {
Expand All @@ -44,27 +32,4 @@ private Object generateCaseId() {
return time + ("0000000000000000".substring(time.length()));
}

private UserTokenProviderConfig buildCcdSpecificConfig() {
UserTokenProviderConfig config = new UserTokenProviderConfig();
config.setMicroService("ccd_data");
config.setSecret(System.getenv("CCD_DATA_S2S_SECRET"));
config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL"));
return config;
}

private UserTokenProviderConfig buildXuiSpecificConfig() {
UserTokenProviderConfig config = new UserTokenProviderConfig();
config.setMicroService("xui_webapp");
config.setSecret(System.getenv("XUI_WEBAPP_S2S_SECRET"));
config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL"));
return config;
}

private UserTokenProviderConfig buildOrmSpecificConfig() {
UserTokenProviderConfig config = new UserTokenProviderConfig();
config.setMicroService("am_org_role_mapping_service");
config.setSecret(System.getenv("AM_ORG_S2S_SECRET"));
config.setS2sUrl(EnvironmentVariableUtils.getRequiredVariable("IDAM_S2S_URL"));
return config;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"specs": [
"an active IDAM profile with full permissions"
],
"method": "DELETE"
"method": "DELETE",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"uri": "/am/role-assignments/{assignmentId}",
"specs": [
"an active IDAM profile with full permissions"
]
],
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "GET",
"uri": "/am/role-assignments/actors/{actorId}"
"uri": "/am/role-assignments/actors/{actorId}",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "/am/role-assignments/query"
"uri": "/am/role-assignments/query",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "GET",
"uri": "am/role-assignments/roles"
"uri": "am/role-assignments/roles",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "/am/role-assignments/query"
"uri": "/am/role-assignments/query",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "/am/role-assignments/query/delete"
"uri": "/am/role-assignments/query/delete",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "GET",
"uri": "/am/role-assignments/actors/{actorId}"
"uri": "/am/role-assignments/actors/{actorId}",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"an active IDAM profile with full permissions"
],
"method": "POST",
"uri": "am/role-assignments"
"uri": "am/role-assignments",
"request": {
"headers": {
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"request": {
"headers": {
"Authorization": "[[DEFAULT_AUTO_VALUE]]",
"ServiceAuthorization": "[[DEFAULT_AUTO_VALUE]]",
"ServiceAuthorization": "${[scenarioContext][customValues][generateS2STokenForOrm]}",
"X-Correlation-ID": "003352d0-e699-48bc-b6f5-5810411e60af",
"Content-Type": "application/json"
},
Expand Down
Loading

0 comments on commit bf6646f

Please sign in to comment.