Added code to decode password and set property
Change-Id: Ied806fcceeaa44d53ca39af636da620fb824e41d
Issue-ID: POLICY-1760
Signed-off-by: Michael Mokry <michael.mokry@att.com>
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
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;
import java.util.Collection;
import java.util.Properties;
//
Properties emProperties = new Properties();
emProperties.putAll(properties);
//
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
//
//
// Create the entity manager factory
//
import com.google.common.base.Strings;
import java.util.Arrays;
import com.google.common.base.Strings;
import java.util.Arrays;
+import java.util.Base64;
import java.util.Collection;
import java.util.Properties;
import java.util.Collection;
import java.util.Properties;
//
Properties emProperties = new Properties();
emProperties.putAll(properties);
//
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
//
//
// Create the entity manager factory
//
javax.persistence.jdbc.driver=org.h2.Driver
javax.persistence.jdbc.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE
javax.persistence.jdbc.user=policy
javax.persistence.jdbc.driver=org.h2.Driver
javax.persistence.jdbc.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=FALSE
javax.persistence.jdbc.user=policy
-javax.persistence.jdbc.password=P01icY
+javax.persistence.jdbc.password=UDAxaWNZ