From 1298fd26f37cd451cbf1adbea68b98151662e796 Mon Sep 17 00:00:00 2001 From: Hima Elisetty Date: Fri, 12 Jan 2018 10:36:42 -0500 Subject: Introduce JUNIT Plumbing Issue-ID: PORTAL-161, PORTAL-160, PORTAL-159 Includes Change in encryption and decryption algorithm Change-Id: I5f379d6d9ac25536744152ac1d61223a52f1ce7f Signed-off-by: Hima Elisetty --- .../src/main/java/org/onap/portalsdk/core/conf/AppConfig.java | 2 +- .../org/onap/portalsdk/core/interceptor/ResourceInterceptor.java | 2 +- .../onap/portalsdk/core/restful/client/PortalRestClientBase.java | 4 ++-- .../java/org/onap/portalsdk/core/service/RestApiRequestBuilder.java | 6 +++--- .../main/java/org/onap/portalsdk/core/service/UrlAccessImpl.java | 2 +- .../org/onap/portalsdk/core/service/WebServiceCallServiceImpl.java | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'ecomp-sdk/epsdk-core/src') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java index 60888b6d..0620945f 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/AppConfig.java @@ -211,7 +211,7 @@ public class AppConfig extends WebMvcConfigurerAdapter implements Configurable, if (SystemProperties.containsProperty(SystemProperties.DB_ENCRYPT_FLAG)) { String encryptFlag = SystemProperties.getProperty(SystemProperties.DB_ENCRYPT_FLAG); if (encryptFlag != null && "true".equalsIgnoreCase(encryptFlag)) { - password = CipherUtil.decrypt(password); + password = CipherUtil.decryptPKC(password); } } dataSource.setPassword(password); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/interceptor/ResourceInterceptor.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/interceptor/ResourceInterceptor.java index 4b4d721c..de65775b 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/interceptor/ResourceInterceptor.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/interceptor/ResourceInterceptor.java @@ -144,7 +144,7 @@ public class ResourceInterceptor extends HandlerInterceptorAdapter { String ecompRestURL = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL); String decreptedPwd = null; try { - decreptedPwd = CipherUtil.decrypt(app.getAppPassword(), + decreptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "handleSessionUpdates failed to decrypt password", e); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/restful/client/PortalRestClientBase.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/restful/client/PortalRestClientBase.java index 2c4da43d..5f9cbdc9 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/restful/client/PortalRestClientBase.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/restful/client/PortalRestClientBase.java @@ -98,7 +98,7 @@ public class PortalRestClientBase { if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null) throw new IllegalArgumentException( "getRestWithCredentials: Missing one or more required properties and/or database entries"); - String decryptedPassword = CipherUtil.decrypt(app.getAppPassword()); + String decryptedPassword = CipherUtil.decryptPKC(app.getAppPassword()); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet(uri); httpGet.setHeader("uebkey", uebKey); @@ -150,7 +150,7 @@ public class PortalRestClientBase { if (uebKey == null || app == null || app.getUsername() == null || app.getAppPassword() == null) throw new IllegalArgumentException( "postRestWithCredentials: missing one or more required properties and/or database entries"); - String decryptedPassword = CipherUtil.decrypt(app.getAppPassword()); + String decryptedPassword = CipherUtil.decryptPKC(app.getAppPassword()); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(uri); httpPost.setHeader("uebkey", uebKey); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RestApiRequestBuilder.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RestApiRequestBuilder.java index c6c40b70..1b3e82cd 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RestApiRequestBuilder.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RestApiRequestBuilder.java @@ -77,7 +77,7 @@ public class RestApiRequestBuilder { appName = app.getName(); appUserName = app.getUsername(); try { - decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), + decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (CipherUtilException e) { logger.error(EELFLoggerDelegate.errorLogger, "getViaREST failed", e); @@ -115,7 +115,7 @@ public class RestApiRequestBuilder { appName = app.getName(); appUserName = app.getUsername(); try { - decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), + decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (CipherUtilException e) { logger.error(EELFLoggerDelegate.errorLogger, "postViaREST failed", e); @@ -152,7 +152,7 @@ public class RestApiRequestBuilder { appName = app.getName(); appUserName = app.getUsername(); try { - decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), + decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (CipherUtilException e) { logger.error(EELFLoggerDelegate.errorLogger, "deleteViaRest failed", e); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UrlAccessImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UrlAccessImpl.java index ddadc101..06073be4 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UrlAccessImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UrlAccessImpl.java @@ -127,7 +127,7 @@ public class UrlAccessImpl implements UrlAccessService { for (int i = 0; i < roleFunctionArray.length; i++) { if (match) { if (!roleFunctionArray[i].equals("*")) { - Pattern p = Pattern.compile(path[i], Pattern.CASE_INSENSITIVE); + Pattern p = Pattern.compile(Pattern.quote(path[i]), Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(roleFunctionArray[i]); match = m.matches(); diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/WebServiceCallServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/WebServiceCallServiceImpl.java index 71479820..f0a17913 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/WebServiceCallServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/WebServiceCallServiceImpl.java @@ -69,7 +69,7 @@ public class WebServiceCallServiceImpl implements WebServiceCallService { if (app != null) { String encriptedPwdDB = app.getAppPassword(); String appUserName = app.getUsername(); - String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, + String decreptedPwd = CipherUtil.decryptPKC(encriptedPwdDB, secretKey == null ? SystemProperties.getProperty(SystemProperties.Decryption_Key) : secretKey); if (decreptedPwd.equals(requestPassword) && appUserName.equals(requestAppName)) { return true; -- cgit 1.2.3-korg