aboutsummaryrefslogtreecommitdiffstats
path: root/ms/sliboot/src/main
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-10-29 14:40:13 -0400
committerDan Timoney <dtimoney@att.com>2021-10-29 15:31:05 -0400
commitfcc85dc1e3c199c72a173dee04c216a17b7e86a7 (patch)
tree0ae58f20a19ef662c2bd8be8ab8990463693a2ff /ms/sliboot/src/main
parent012d5a145fa2b04554f53079731062f6c46f2d90 (diff)
Sync local changes to support GRA microservice
Sync changes made downstream to support GRA microservice Issue-ID: CCSDK-3504 Change-Id: I5fd99b978edb9598c5fe38f188635b365ad4e24c Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms/sliboot/src/main')
-rwxr-xr-xms/sliboot/src/main/dc/docker-compose.yaml6
-rw-r--r--ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/FilterConfiguration.java66
-rw-r--r--ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/SlibootApp.java6
3 files changed, 73 insertions, 5 deletions
diff --git a/ms/sliboot/src/main/dc/docker-compose.yaml b/ms/sliboot/src/main/dc/docker-compose.yaml
index 7b85745a..a6bd9b5a 100755
--- a/ms/sliboot/src/main/dc/docker-compose.yaml
+++ b/ms/sliboot/src/main/dc/docker-compose.yaml
@@ -30,11 +30,13 @@ services:
links:
- db:dbhost
environment:
- - MYSQL_HOST=dbhost
+ - MYSQL_DB_HOST=dbhost
+ - MYSQL_DB_USER=${MYSQL_USER}
+ - MYSQL_DB_PASSWD=${MYSQL_PASSWORD}
+ - MYSQL_DB_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- SDNC_CONFIG_DIR=/opt/onap/ccsdk/config
logging:
driver: "json-file"
diff --git a/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/FilterConfiguration.java b/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/FilterConfiguration.java
new file mode 100644
index 00000000..295953a4
--- /dev/null
+++ b/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/FilterConfiguration.java
@@ -0,0 +1,66 @@
+package org.onap.ccsdk.apps.ms.sliboot;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.onap.aaf.cadi.filter.CadiFilter;
+import org.onap.ccsdk.sli.core.utils.common.EnvProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+
+@Configuration
+@ConditionalOnProperty("cadi.properties.path")
+public class FilterConfiguration {
+ private static final Logger log = LoggerFactory.getLogger(FilterConfiguration.class);
+
+ @Value( "${cadi.properties.path:none}" )
+ private String cadiPropFile;
+
+ @Bean
+ @Order(1)
+ public FilterRegistrationBean<CadiFilter> cadiFilter() {
+ CadiFilter filter = new CadiFilter();
+
+ FilterRegistrationBean<CadiFilter> registrationBean = new FilterRegistrationBean<>();
+ registrationBean.setFilter(filter);
+ if ("none".equals(cadiPropFile)) {
+ log.info("cadi.properties.path undefined, AAF CADI disabled");
+ registrationBean.setEnabled(false);
+ registrationBean.addUrlPatterns("/xxxx/*");
+ } else {
+ // Note: assume that cadi.properties.path specifies full path to properties file
+ File cadiFile = new File(cadiPropFile);
+ if (!cadiFile.exists()) {
+ log.info("cadi properties file {} not found, AAF CADI disabled", cadiPropFile);
+ registrationBean.setEnabled(false);
+ registrationBean.addUrlPatterns("/xxxx/*");
+ } else {
+ Properties cadiProperties = new EnvProperties();
+ try {
+ cadiProperties.load(new FileReader(cadiFile));
+ cadiProperties.forEach((k, v) -> {
+ registrationBean.addInitParameter((String) k, cadiProperties.getProperty((String) k));
+ });
+ registrationBean.addUrlPatterns("/*");
+ log.info("Installed and configured CADI filter");
+ } catch (IOException e) {
+ log.info("Caught exception loading cadi properties file {}, AAF CADI disabled", cadiPropFile, e);
+ registrationBean.setEnabled(false);
+ registrationBean.addUrlPatterns("/xxxx/*");
+ }
+ }
+
+ }
+
+ return registrationBean;
+ }
+
+}
diff --git a/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/SlibootApp.java b/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/SlibootApp.java
index 2bca1dbc..0fd23a9e 100644
--- a/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/SlibootApp.java
+++ b/ms/sliboot/src/main/java/org/onap/ccsdk/apps/ms/sliboot/SlibootApp.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,6 +67,6 @@ public class SlibootApp {
}
return registrationBean;
- }
+ }
}