From 735a5b2a392903616d613f7b3715efd028509014 Mon Sep 17 00:00:00 2001 From: soletsdev Date: Thu, 22 Feb 2024 13:53:12 -0800 Subject: [PATCH 1/2] fixing pagination call for school contacts. Also adding in missing READ_SCHOOL_CONTACT role for client. --- .../java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java | 9 ++++++--- tools/config/update-configmap.sh | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java b/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java index 24dee4d5..90eb8083 100644 --- a/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java @@ -107,6 +107,7 @@ private void initialize() { this.populatePenRequestBatchStudentValidationIssueTypeCodeMap(); this.populatePenRequestBatchStudentValidationIssueFieldCodeMap(); this.setGradeCodesMap(); + this.getStudentRegistrationContactList("04090036"); log.info("Called student api and loaded {} grade codes", this.gradeCodesMap.values().size()); } @@ -383,9 +384,11 @@ public List getStudentRegistrationContactList(final String mincod return new ArrayList<>(); } log.info("Calling Institute api to get list of school student registration contacts"); - String criterion = "[{\"searchCriteriaList\":[{\"key\":\"schoolContactTypeCode\",\"operation\":\"eq\",\"value\":\"STUDREGIS\",\"valueType\":\"STRING\",\"condition\":\"AND\"}]}," + - " {\"key\":\"schoolId\",\"operation\":\"eq\",\"value\":\"" + school.getSchoolId() + "\",\"valueType\":\"UUID\",\"condition\":\"AND\"}]}," + - " {\"key\":\"email\",\"operation\":\"neq\",\"value\":\"null\",\"valueType\":\"UUID\",\"condition\":\"AND\"}]}"; + String criterion = "[{\"condition\":null,\"searchCriteriaList\":[" + + "{\"key\":\"schoolContactTypeCode\",\"operation\":\"eq\",\"value\":\"STUDREGIS\",\"valueType\":\"STRING\",\"condition\":\"AND\"}," + + "{\"key\":\"schoolID\",\"operation\":\"eq\",\"value\":\"" + school.getSchoolId() + "\",\"valueType\":\"UUID\",\"condition\":\"AND\"}," + + "{\"key\":\"email\",\"operation\":\"neq\",\"value\":\"null\",\"valueType\":\"STRING\",\"condition\":\"AND\"}" + + "]}]"; SchoolContactSearchWrapper schoolContactSearchWrapper = this.webClient.get() .uri(getSchoolContactURI(criterion)) .header(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) diff --git a/tools/config/update-configmap.sh b/tools/config/update-configmap.sh index f83f9232..210a7755 100644 --- a/tools/config/update-configmap.sh +++ b/tools/config/update-configmap.sh @@ -42,7 +42,7 @@ echo Creating client pen-reg-batch-api-service curl -sX POST "https://$SOAM_KC/auth/admin/realms/$SOAM_KC_REALM_ID/clients" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TKN" \ - -d "{\"clientId\" : \"pen-reg-batch-api-service\",\"surrogateAuthRequired\" : false,\"enabled\" : true,\"clientAuthenticatorType\" : \"client-secret\",\"redirectUris\" : [ ],\"webOrigins\" : [ ],\"notBefore\" : 0,\"bearerOnly\" : false,\"consentRequired\" : false,\"standardFlowEnabled\" : false,\"implicitFlowEnabled\" : false,\"directAccessGrantsEnabled\" : false,\"serviceAccountsEnabled\" : true,\"publicClient\" : false,\"frontchannelLogout\" : false,\"protocol\" : \"openid-connect\",\"attributes\" : {\"saml.assertion.signature\" : \"false\",\"saml.multivalued.roles\" : \"false\",\"saml.force.post.binding\" : \"false\",\"saml.encrypt\" : \"false\",\"saml.server.signature\" : \"false\",\"saml.server.signature.keyinfo.ext\" : \"false\",\"exclude.session.state.from.auth.response\" : \"false\",\"saml_force_name_id_format\" : \"false\",\"saml.client.signature\" : \"false\",\"tls.client.certificate.bound.access.tokens\" : \"false\",\"saml.authnstatement\" : \"false\",\"display.on.consent.screen\" : \"false\",\"saml.onetimeuse.condition\" : \"false\"},\"authenticationFlowBindingOverrides\" : { },\"fullScopeAllowed\" : true,\"nodeReRegistrationTimeout\" : -1,\"protocolMappers\" : [ {\"name\" : \"Client ID\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientId\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientId\",\"jsonType.label\" : \"String\"}}, {\"name\" : \"Client Host\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientHost\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientHost\",\"jsonType.label\" : \"String\"}}, {\"name\" : \"Client IP Address\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientAddress\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientAddress\",\"jsonType.label\" : \"String\"}} ],\"defaultClientScopes\" : [ \"web-origins\", \"WRITE_STUDENT\", \"role_list\", \"profile\", \"roles\", \"READ_STUDENT\",\"GET_NEXT_PEN_NUMBER\", \"READ_SCHOOL\", \"email\",\"READ_STUDENT_CODES\",\"READ_VALIDATION_CODES\"],\"optionalClientScopes\" : [ \"address\", \"phone\", \"offline_access\" ],\"access\" : {\"view\" : true,\"configure\" : true,\"manage\" : true}}" + -d "{\"clientId\" : \"pen-reg-batch-api-service\",\"surrogateAuthRequired\" : false,\"enabled\" : true,\"clientAuthenticatorType\" : \"client-secret\",\"redirectUris\" : [ ],\"webOrigins\" : [ ],\"notBefore\" : 0,\"bearerOnly\" : false,\"consentRequired\" : false,\"standardFlowEnabled\" : false,\"implicitFlowEnabled\" : false,\"directAccessGrantsEnabled\" : false,\"serviceAccountsEnabled\" : true,\"publicClient\" : false,\"frontchannelLogout\" : false,\"protocol\" : \"openid-connect\",\"attributes\" : {\"saml.assertion.signature\" : \"false\",\"saml.multivalued.roles\" : \"false\",\"saml.force.post.binding\" : \"false\",\"saml.encrypt\" : \"false\",\"saml.server.signature\" : \"false\",\"saml.server.signature.keyinfo.ext\" : \"false\",\"exclude.session.state.from.auth.response\" : \"false\",\"saml_force_name_id_format\" : \"false\",\"saml.client.signature\" : \"false\",\"tls.client.certificate.bound.access.tokens\" : \"false\",\"saml.authnstatement\" : \"false\",\"display.on.consent.screen\" : \"false\",\"saml.onetimeuse.condition\" : \"false\"},\"authenticationFlowBindingOverrides\" : { },\"fullScopeAllowed\" : true,\"nodeReRegistrationTimeout\" : -1,\"protocolMappers\" : [ {\"name\" : \"Client ID\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientId\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientId\",\"jsonType.label\" : \"String\"}}, {\"name\" : \"Client Host\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientHost\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientHost\",\"jsonType.label\" : \"String\"}}, {\"name\" : \"Client IP Address\",\"protocol\" : \"openid-connect\",\"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\"consentRequired\" : false,\"config\" : {\"user.session.note\" : \"clientAddress\",\"id.token.claim\" : \"true\",\"access.token.claim\" : \"true\",\"claim.name\" : \"clientAddress\",\"jsonType.label\" : \"String\"}} ],\"defaultClientScopes\" : [ \"web-origins\", \"WRITE_STUDENT\", \"role_list\", \"profile\", \"roles\", \"READ_STUDENT\",\"GET_NEXT_PEN_NUMBER\", \"READ_SCHOOL\", \"READ_SCHOOL_CONTACT\", \"email\",\"READ_STUDENT_CODES\",\"READ_VALIDATION_CODES\"],\"optionalClientScopes\" : [ \"address\", \"phone\", \"offline_access\" ],\"access\" : {\"view\" : true,\"configure\" : true,\"manage\" : true}}" echo echo Retrieving client ID for pen-reg-batch-api-service From b0c140d3ce3c4a7c7f1a6d7bfca1a692b4c8371f Mon Sep 17 00:00:00 2001 From: soletsdev Date: Thu, 22 Feb 2024 13:56:14 -0800 Subject: [PATCH 2/2] code cleanup --- api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java b/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java index 90eb8083..cc7fcf76 100644 --- a/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/penreg/api/rest/RestUtils.java @@ -107,7 +107,6 @@ private void initialize() { this.populatePenRequestBatchStudentValidationIssueTypeCodeMap(); this.populatePenRequestBatchStudentValidationIssueFieldCodeMap(); this.setGradeCodesMap(); - this.getStudentRegistrationContactList("04090036"); log.info("Called student api and loaded {} grade codes", this.gradeCodesMap.values().size()); }