* ============LICENSE_START==========================================
* ONAP Portal
* ===================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.Date;
import java.util.List;
import org.onap.portalapp.portal.logging.logic.EPLogUtil;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.util.CipherUtil;
-import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
import org.onap.portalsdk.core.util.SystemProperties;
import org.slf4j.MDC;
import org.springframework.http.HttpHeaders;
/**
*
- * It check whether the external auth namespace is matching with current namepsace exists in local DB
+ * It check whether the external auth namespace is matching with current namespace exists in local DB
*
* @param permTypeVal
* @param appNamespaceVal
String[] typeNamespace = permTypeVal.split("\\.");
String[] appNamespace = appNamespaceVal.split("\\.");
boolean isNamespaceMatching = true;
- for (int k = 0; k < appNamespace.length; k++) {
- if (!appNamespace[k].equals(typeNamespace[k]))
- isNamespaceMatching = false;
+ if (appNamespace.length <= typeNamespace.length) {
+ for (int k = 0; k < appNamespace.length; k++) {
+ if (!appNamespace[k].equals(typeNamespace[k]))
+ isNamespaceMatching = false;
+ }
+ } else {
+ isNamespaceMatching = false;
}
return isNamespaceMatching;
}
return false;
}
}
+ /**
+ *
+ * It retrieves account information from input String
+ *
+ * @param authValue
+ * @return Array of Account information
+ *
+ */
+ public static String[] getUserNamePassword(String authValue) {
+ String base64Credentials = authValue.substring("Basic".length()).trim();
+ String credentials = new String(Base64.getDecoder().decode(base64Credentials), Charset.forName("UTF-8"));
+ final String[] values = credentials.split(":", 2);
+ return values;
+ }
}