From 9b7ec4e1663fcc7381011979757a99ea57b9922c Mon Sep 17 00:00:00 2001 From: Gabriel Poleze Ferreira Date: Mon, 29 Aug 2022 11:17:48 -0700 Subject: [PATCH 01/12] updating maven version --- AutomatedTest/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomatedTest/pom.xml b/AutomatedTest/pom.xml index 0388a1e..f516186 100644 --- a/AutomatedTest/pom.xml +++ b/AutomatedTest/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.5.12 + 2.7.3 diff --git a/pom.xml b/pom.xml index 24be86b..d07b0f4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.5.12 + 2.7.3 ca.bc.gov.open From f81cb3006913c1fc73dd88954d0c689ed936464b Mon Sep 17 00:00:00 2001 From: Gabriel Poleze Ferreira Date: Mon, 29 Aug 2022 11:38:34 -0700 Subject: [PATCH 02/12] updating deprecated java base image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b840a9b..d56bbdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11-jre-slim +FROM eclipse-temurin:11-jre-jammy COPY ./target/cdds-application.jar cdds-application.jar From 3e5827bfcabc39b3f7ba8a611ee8457fe5f33b0d Mon Sep 17 00:00:00 2001 From: Gabriel Poleze Ferreira Date: Mon, 29 Aug 2022 14:50:04 -0700 Subject: [PATCH 03/12] Managing google-oauth-client and xstream dependencies --- AutomatedTest/Dockerfile | 2 +- AutomatedTest/pom.xml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/AutomatedTest/Dockerfile b/AutomatedTest/Dockerfile index c51b006..f0f1e83 100644 --- a/AutomatedTest/Dockerfile +++ b/AutomatedTest/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11-jre-slim +FROM eclipse-temurin:11-jre-jammy WORKDIR /app RUN chgrp -R 0 /app && \ diff --git a/AutomatedTest/pom.xml b/AutomatedTest/pom.xml index f516186..ebb6b67 100644 --- a/AutomatedTest/pom.xml +++ b/AutomatedTest/pom.xml @@ -39,6 +39,14 @@ org.slf4j slf4j-log4j12 + + thoughtworks + xstream + + + com.google.oauth-client + google-oauth-client + @@ -82,6 +90,16 @@ org.springframework spring-webmvc + + com.google.oauth-client + google-oauth-client + 1.34.1 + + + com.thoughtworks.xstream + xstream + 1.4.19 + From 69b2b8e491a1bad7de41df357c2a819af1fe5179 Mon Sep 17 00:00:00 2001 From: Gabriel Poleze Ferreira Date: Mon, 29 Aug 2022 14:50:43 -0700 Subject: [PATCH 04/12] bumping version --- AutomatedTest/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomatedTest/pom.xml b/AutomatedTest/pom.xml index ebb6b67..eba2c36 100644 --- a/AutomatedTest/pom.xml +++ b/AutomatedTest/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ca.bc.gov.open.cdds.test - 1.0.0 + 1.0.1 4.0.0 AutomatedTest diff --git a/pom.xml b/pom.xml index d07b0f4..be31402 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ ca.bc.gov.open jag-cdds - 1.0 + 1.0.1 jag-cdds jag-cdds From 4e61caffa4a98eb499bf71c2e7b661cd0be351dd Mon Sep 17 00:00:00 2001 From: Gabriel Poleze Ferreira Date: Wed, 31 Aug 2022 10:05:32 -0700 Subject: [PATCH 05/12] fixing release version --- AutomatedTest/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AutomatedTest/pom.xml b/AutomatedTest/pom.xml index eba2c36..106c4c3 100644 --- a/AutomatedTest/pom.xml +++ b/AutomatedTest/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ca.bc.gov.open.cdds.test - 1.0.1 + 1.1 4.0.0 AutomatedTest diff --git a/pom.xml b/pom.xml index be31402..395b4a3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ ca.bc.gov.open jag-cdds - 1.0.1 + 1.1 jag-cdds jag-cdds From f850a5a424c2a519d2fd3d0b9a2634291cac23ff Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 09:55:41 -0800 Subject: [PATCH 06/12] added ords auth --- gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml | 10 ++++++++++ .../ca/bc/gov/open/cdds/configuration/SoapConfig.java | 11 +++++++++-- src/main/resources/application-test.yml | 2 ++ src/main/resources/application.yml | 2 ++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml b/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml index 4817654..19024c9 100644 --- a/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml +++ b/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml @@ -120,6 +120,16 @@ objects: secretKeyRef: name: cdds-application-secrets key: ORDS_HOST + - name: ORDS_USERNAME + valueFrom: + secretKeyRef: + name: ccd-application-secrets + key: ORDS_USERNAME + - name: ORDS_PASSWORD + valueFrom: + secretKeyRef: + name: ccd-application-secrets + key: ORDS_PASSWORD resources: limits: cpu: 500m diff --git a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java index e444f7f..27860a1 100644 --- a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java +++ b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java @@ -12,6 +12,8 @@ import java.util.Map; import javax.xml.soap.SOAPMessage; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; @@ -40,6 +42,11 @@ @Configuration @Slf4j public class SoapConfig extends WsConfigurerAdapter { + @Value("${cdds.username}") + private String username; + + @Value("${cdds.password}") + private String password; public static final String SOAP_NAMESPACE = "http://courts.gov.bc.ca/xml/ns/cdds/v1"; @@ -100,8 +107,8 @@ public ServletRegistrationBean messageDispatcherServle } @Bean - public RestTemplate restTemplate() { - RestTemplate restTemplate = new RestTemplate(); + public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { + var restTemplate = restTemplateBuilder.basicAuthentication(username, password).build(); restTemplate.getMessageConverters().add(0, createMappingJacksonHttpMessageConverter()); return restTemplate; } diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index f3d89a1..4f46560 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -5,3 +5,5 @@ security: cdds: host: http://127.0.0.1/ namespace: ${CDDS_NAMESPACE} + username: ${BASIC_AUTH_USER} + password: ${BASIC_AUTH_PASS} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3101bd1..1dedf4c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,6 +5,8 @@ security: cdds: host: ${ORDS_HOST} namespace: ${CDDS_NAMESPACE} + username: ${ORDS_USERNAME} + password: ${ORDS_PASSWORD} management: trace: http: From 42e33a531f3360d1fa0247aa190f023ef0e085ea Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 11:30:20 -0800 Subject: [PATCH 07/12] Update jag-cdds.yaml --- gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml b/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml index 19024c9..5c66c10 100644 --- a/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml +++ b/gitops/openshift/apps/jag-cdds/template/jag-cdds.yaml @@ -123,12 +123,12 @@ objects: - name: ORDS_USERNAME valueFrom: secretKeyRef: - name: ccd-application-secrets + name: cdds-application-secrets key: ORDS_USERNAME - name: ORDS_PASSWORD valueFrom: secretKeyRef: - name: ccd-application-secrets + name: cdds-application-secrets key: ORDS_PASSWORD resources: limits: From 782f18849bf5a069f8bb7fdb337ab47a4a49d7ac Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 11:53:58 -0800 Subject: [PATCH 08/12] Update SoapConfig.java --- .../java/ca/bc/gov/open/cdds/configuration/SoapConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java index 27860a1..6ac1bb2 100644 --- a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java +++ b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java @@ -43,10 +43,10 @@ @Slf4j public class SoapConfig extends WsConfigurerAdapter { @Value("${cdds.username}") - private String username; + private String username = ""; @Value("${cdds.password}") - private String password; + private String password = ""; public static final String SOAP_NAMESPACE = "http://courts.gov.bc.ca/xml/ns/cdds/v1"; From b17b24a702b837cb81a180de4471f9c16484cd14 Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 12:05:51 -0800 Subject: [PATCH 09/12] Update SoapConfig.java --- .../open/cdds/configuration/SoapConfig.java | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java index 6ac1bb2..c811f4f 100644 --- a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java +++ b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import java.time.Instant; import java.util.HashMap; -import java.util.List; import java.util.Map; import javax.xml.soap.SOAPMessage; import lombok.extern.slf4j.Slf4j; @@ -20,23 +19,15 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; import org.springframework.ws.config.annotation.EnableWs; import org.springframework.ws.config.annotation.WsConfigurerAdapter; -import org.springframework.ws.server.EndpointInterceptor; import org.springframework.ws.soap.SoapVersion; import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; -import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor; import org.springframework.ws.transport.http.MessageDispatcherServlet; import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition; import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition; -import org.springframework.xml.validation.XmlValidator; -import org.springframework.xml.validation.XmlValidatorFactory; -import org.springframework.xml.xsd.SimpleXsdSchema; -import org.springframework.xml.xsd.XsdSchema; -import org.springframework.xml.xsd.XsdSchemaCollection; @EnableWs @Configuration @@ -50,53 +41,6 @@ public class SoapConfig extends WsConfigurerAdapter { public static final String SOAP_NAMESPACE = "http://courts.gov.bc.ca/xml/ns/cdds/v1"; - @Override - public void addInterceptors(List interceptors) { - // There are 2 versions of schemas to de couple model generation and request validation - // Suffix v means its a validation schema - var validatingInterceptor1 = interceptor1(); - // interceptors.add(validatingInterceptor1); - } - - private PayloadValidatingInterceptor interceptor1() { - CustomPayloadValidator validatingInterceptor = new CustomPayloadValidator(); - // validatingInterceptor.setValidateRequest(true); - validatingInterceptor.setXsdSchemaCollection( - new XsdSchemaCollection() { - @Override - public XsdSchema[] getXsdSchemas() { - return new XsdSchema[] { - new SimpleXsdSchema( - new ClassPathResource("validation/cdds-models-1v.xsd")), - new SimpleXsdSchema( - new ClassPathResource("validation/cdds-models-2v.xsd")), - new SimpleXsdSchema( - new ClassPathResource("validation/cdds-models-3v.xsd")) - }; - } - - @Override - public XmlValidator createValidator() { - try { - return XmlValidatorFactory.createValidator( - getSchemas(), "http://www.w3.org/2001/XMLSchema"); - } catch (Exception e) { - log.warn("XSD schema validation failed"); - } - return null; - } - - public Resource[] getSchemas() { - return new Resource[] { - new ClassPathResource("validation/cdds-models-1v.xsd"), - new ClassPathResource("validation/cdds-models-2v.xsd"), - new ClassPathResource("validation/cdds-models-3v.xsd") - }; - } - }); - return validatingInterceptor; - } - @Bean public ServletRegistrationBean messageDispatcherServlet( ApplicationContext applicationContext) { From a1a2a3d4d274741aca99f07359460f86aa117b0e Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 12:08:37 -0800 Subject: [PATCH 10/12] Update SoapConfig.java --- .../open/cdds/configuration/SoapConfig.java | 70 +++++++++++++++++-- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java index c811f4f..206584f 100644 --- a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java +++ b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java @@ -8,10 +8,10 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import java.time.Instant; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.xml.soap.SOAPMessage; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; @@ -19,28 +19,83 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; import org.springframework.ws.config.annotation.EnableWs; import org.springframework.ws.config.annotation.WsConfigurerAdapter; +import org.springframework.ws.server.EndpointInterceptor; import org.springframework.ws.soap.SoapVersion; import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; +import org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor; import org.springframework.ws.transport.http.MessageDispatcherServlet; import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition; import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition; +import org.springframework.xml.validation.XmlValidator; +import org.springframework.xml.validation.XmlValidatorFactory; +import org.springframework.xml.xsd.SimpleXsdSchema; +import org.springframework.xml.xsd.XsdSchema; +import org.springframework.xml.xsd.XsdSchemaCollection; @EnableWs @Configuration @Slf4j public class SoapConfig extends WsConfigurerAdapter { - @Value("${cdds.username}") - private String username = ""; - - @Value("${cdds.password}") - private String password = ""; + // @Value("${cdds.username}") + // private String username = ""; + // + // @Value("${cdds.password}") + // private String password = ""; public static final String SOAP_NAMESPACE = "http://courts.gov.bc.ca/xml/ns/cdds/v1"; + @Override + public void addInterceptors(List interceptors) { + // There are 2 versions of schemas to de couple model generation and request validation + // Suffix v means its a validation schema + // var validatingInterceptor1 = interceptor1(); + // interceptors.add(validatingInterceptor1); + } + + private PayloadValidatingInterceptor interceptor1() { + CustomPayloadValidator validatingInterceptor = new CustomPayloadValidator(); + // validatingInterceptor.setValidateRequest(true); + validatingInterceptor.setXsdSchemaCollection( + new XsdSchemaCollection() { + @Override + public XsdSchema[] getXsdSchemas() { + return new XsdSchema[] { + new SimpleXsdSchema( + new ClassPathResource("validation/cdds-models-1v.xsd")), + new SimpleXsdSchema( + new ClassPathResource("validation/cdds-models-2v.xsd")), + new SimpleXsdSchema( + new ClassPathResource("validation/cdds-models-3v.xsd")) + }; + } + + @Override + public XmlValidator createValidator() { + try { + return XmlValidatorFactory.createValidator( + getSchemas(), "http://www.w3.org/2001/XMLSchema"); + } catch (Exception e) { + log.warn("XSD schema validation failed"); + } + return null; + } + + public Resource[] getSchemas() { + return new Resource[] { + new ClassPathResource("validation/cdds-models-1v.xsd"), + new ClassPathResource("validation/cdds-models-2v.xsd"), + new ClassPathResource("validation/cdds-models-3v.xsd") + }; + } + }); + return validatingInterceptor; + } + @Bean public ServletRegistrationBean messageDispatcherServlet( ApplicationContext applicationContext) { @@ -52,7 +107,8 @@ public ServletRegistrationBean messageDispatcherServle @Bean public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { - var restTemplate = restTemplateBuilder.basicAuthentication(username, password).build(); + // var restTemplate = restTemplateBuilder.basicAuthentication(username, password).build(); + RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(0, createMappingJacksonHttpMessageConverter()); return restTemplate; } From 4d750f34d2ee43f1038aa91a27d6f2c8be747256 Mon Sep 17 00:00:00 2001 From: "Sylar Z. Zhang" Date: Fri, 3 Feb 2023 13:29:41 -0800 Subject: [PATCH 11/12] Update SoapConfig.java --- .../bc/gov/open/cdds/configuration/SoapConfig.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java index 206584f..80db965 100644 --- a/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java +++ b/src/main/java/ca/bc/gov/open/cdds/configuration/SoapConfig.java @@ -12,6 +12,7 @@ import java.util.Map; import javax.xml.soap.SOAPMessage; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; @@ -41,11 +42,11 @@ @Configuration @Slf4j public class SoapConfig extends WsConfigurerAdapter { - // @Value("${cdds.username}") - // private String username = ""; - // - // @Value("${cdds.password}") - // private String password = ""; + @Value("${cdds.username}") + private String username; + + @Value("${cdds.password}") + private String password; public static final String SOAP_NAMESPACE = "http://courts.gov.bc.ca/xml/ns/cdds/v1"; @@ -107,8 +108,7 @@ public ServletRegistrationBean messageDispatcherServle @Bean public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { - // var restTemplate = restTemplateBuilder.basicAuthentication(username, password).build(); - RestTemplate restTemplate = new RestTemplate(); + var restTemplate = restTemplateBuilder.basicAuthentication(username, password).build(); restTemplate.getMessageConverters().add(0, createMappingJacksonHttpMessageConverter()); return restTemplate; } From 1b64915854b2c641871d133b2aae2a6ec5d0ac6f Mon Sep 17 00:00:00 2001 From: nikola-rados Date: Thu, 2 Mar 2023 14:57:59 -0800 Subject: [PATCH 12/12] Update dependencies without code changes --- pom.xml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 395b4a3..dc7b1ea 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.3 + 2.7.9 ca.bc.gov.open @@ -191,6 +191,22 @@ + + + + org.yaml + snakeyaml + 1.33 + + + com.fasterxml.jackson.core + jackson-core + 2.14.2 + + + + + cdds-application @@ -311,7 +327,12 @@ + + org.owasp + dependency-check-maven + 7.0.4 + - + \ No newline at end of file