summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main/java/org
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-09-16 10:21:36 -0400
committerRam Krishna Verma <ram_krishna.verma@bell.ca>2020-09-16 14:14:40 -0400
commit52cb02b2033708a0401d5ea165d84f4cdb911628 (patch)
treecbc6096c0285341bd0f1d059f8d87abbbf0443aa /models-provider/src/main/java/org
parent384cf725e41714803d77f84058be88c98bd0eb0c (diff)
Remove base64 encoding of password from models
Remove base64 encoding of db password from models. This will have impact on the defaultConfig of API & PAP component. Seperate reviews are raised for those repos. Issue-ID: POLICY-2550 Change-Id: I258f76d01c21893bb40b4095a82e56ed51bd1377 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'models-provider/src/main/java/org')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java3
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java13
2 files changed, 3 insertions, 13 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
index bcf9ec11e..e2784b040 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +40,7 @@ import org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl;
* defaults to {@link DatabasePolicyModelsProviderImpl} and may not be null
* <li>databaseUrl: The JDBC URL for the database, mandatory.
* <li>databaseUser: The user id to use for connecting to the database, optional, defaults to null.
- * <li>databasePassword: The password to use for connecting to the database encoded in Base64, optional,
+ * <li>databasePassword: The password to use for connecting to the database, optional,
* defaults to null.
* <li>persistenceUnit: The persistence unit refined in META-INF/persistence.xml to use for connecting
* to the database, mandatory.
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index 77a72adb0..e27b9a43c 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -22,7 +22,6 @@
package org.onap.policy.models.provider.impl;
-import java.util.Base64;
import java.util.Date;
import java.util.List;
import java.util.Properties;
@@ -95,15 +94,12 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
- // Decode the password using Base64
- String decodedPassword = new String(Base64.getDecoder().decode(getValue(parameters.getDatabasePassword())));
-
// @formatter:off
Properties jdbcProperties = new Properties();
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, parameters.getDatabaseDriver());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, parameters.getDatabaseUrl());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, parameters.getDatabaseUser());
- jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, decodedPassword);
+ jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, parameters.getDatabasePassword());
// @formatter:on
daoParameters.setJdbcProperties(jdbcProperties);
@@ -120,13 +116,6 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
}
- private String getValue(final String value) {
- if (value != null && value.startsWith("${") && value.endsWith("}")) {
- return System.getenv(value.substring(2, value.length() - 1));
- }
- return value;
- }
-
@Override
public void close() throws PfModelException {
LOGGER.debug("closing the database connection to {} using persistence unit {}", parameters.getDatabaseUrl(),