From edaece07fe7f9e6d87f01fb1bf42817f55fc59f1 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Wed, 15 May 2019 12:54:25 -0500 Subject: Change to fix SQLInvalidAuthorizationSpecException Added code to decode password and set property Change-Id: Ied806fcceeaa44d53ca39af636da620fb824e41d Issue-ID: POLICY-1760 Signed-off-by: Michael Mokry --- .../common/operationshistory/CountRecentOperationsPip.java | 9 +++++++++ .../common/operationshistory/GetOperationOutcomePip.java | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'applications/common/src/main') diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPip.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPip.java index 00f7680b..7304dfca 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPip.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/CountRecentOperationsPip.java @@ -33,6 +33,7 @@ import java.sql.Timestamp; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Arrays; +import java.util.Base64; import java.util.Collection; import java.util.Properties; @@ -70,6 +71,14 @@ public class CountRecentOperationsPip extends StdOnapPip { // Properties emProperties = new Properties(); emProperties.putAll(properties); + + // + // Need to decode the password before creating the EntityManager + // + String decodedPassword = new String(Base64.getDecoder() + .decode(emProperties.getProperty("javax.persistence.jdbc.password"))); + emProperties.setProperty("javax.persistence.jdbc.password", decodedPassword); + // // Create the entity manager factory // diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePip.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePip.java index 4f327cf5..f2339b11 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePip.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/operationshistory/GetOperationOutcomePip.java @@ -29,6 +29,7 @@ import com.att.research.xacml.std.pip.StdPIPResponse; import com.google.common.base.Strings; import java.util.Arrays; +import java.util.Base64; import java.util.Collection; import java.util.Properties; @@ -66,6 +67,14 @@ public class GetOperationOutcomePip extends StdOnapPip { // Properties emProperties = new Properties(); emProperties.putAll(properties); + + // + // Need to decode the password before creating the EntityManager + // + String decodedPassword = new String(Base64.getDecoder() + .decode(emProperties.getProperty("javax.persistence.jdbc.password"))); + emProperties.setProperty("javax.persistence.jdbc.password", decodedPassword); + // // Create the entity manager factory // -- cgit 1.2.3-korg