Graceful Fallback if no decryption
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / utils / EcompPortalUtils.java
index 30eeac0..db984a6 100644 (file)
@@ -376,6 +376,15 @@ public class EcompPortalUtils {
        public static String widgetMsProtocol() {
                return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_PROTOCOL, "https");
        }
+       
+       /**
+        * Answers the protocol to use.
+        * 
+        * @return Protocol name from property file; defaults to https.
+        */
+       public static String widgetMLProtocol() {
+               return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_ML_PROTOCOL, "https");
+       }
 
        /**
         * Answers the host to use.
@@ -385,6 +394,15 @@ public class EcompPortalUtils {
        public static String localOrDockerHost() {
                return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_HOSTNAME, "localhost");
        }
+       
+       /**
+        * Answers the host to use.
+        * 
+        * @return Host name from property file; defaults to localhost.
+        */
+       public static String mlLocalOrDockerHost() {
+               return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_ML_HOSTNAME, "localhost");
+       }
 
        /**
         * It returns headers where username and password of external central auth is
@@ -402,7 +420,13 @@ public class EcompPortalUtils {
                        decryptedPass = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD);
                        userName = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME);
                }
-               String decPass = decrypted(decryptedPass);
+               String decPass;
+               try {
+                       decPass = decrypted(decryptedPass);
+               } catch (Exception e) {
+                       logger.warn(EELFLoggerDelegate.errorLogger, "decryptedPassword failed using non decrypted pwd from the Properties file", e);
+                       decPass = decryptedPass;
+               }
                String usernamePass = userName + ":" + decPass;
                String encToBase64 = String.valueOf((DatatypeConverter.printBase64Binary(usernamePass.getBytes())));
                HttpHeaders headers = new HttpHeaders();