From d6634a7505df8358322b04b8892139195031e5eb Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Fri, 12 Oct 2012 00:40:12 -0400 Subject: Reverted to old interface and httpclient to get installation token. This is a workaround until we can get the new interface working on IPA clones. --- .../cms/servlet/csadmin/ConfigurationUtils.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'base/common/src/com/netscape') diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java index 81c9e7fe3..89233bdc2 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java @@ -315,6 +315,11 @@ public class ConfigurationUtils { public static String getInstallToken(String sdhost, int sdport, String user, String passwd) throws EPropertyNotFound, EBaseException, URISyntaxException, IOException { IConfigStore cs = CMS.getConfigStore(); + boolean oldtoken = cs.getBoolean("cs.useOldTokenInterface", true); + + if (oldtoken) { + return ConfigurationUtils.getOldToken(sdhost, sdport, user, passwd); + } String csType = cs.getString("cs.type"); InstallTokenRequest data = new InstallTokenRequest(user, passwd, csType, CMS.getEEHost(), CMS.getAdminPort()); @@ -356,6 +361,23 @@ public class ConfigurationUtils { return getContentValue(body, "header.session_id"); } + public static String getOldToken(String sdhost, int sdport, String user, String passwd) throws IOException, + EPropertyNotFound, EBaseException, URISyntaxException { + IConfigStore cs = CMS.getConfigStore(); + + String subca_url = "https://" + CMS.getEEHost() + ":" + + CMS.getAdminPort() + "/ca/admin/console/config/wizard" + + "?p=5&subsystem=" + cs.getString("cs.type"); + + String content = "uid=" + URLEncoder.encode(user, "UTF-8") + "&pwd=" + URLEncoder.encode(passwd, "UTF-8") + + "&url=" + URLEncoder.encode(subca_url, "UTF-8"); + + String response = ConfigurationUtils.getHttpResponse(sdhost, sdport, true, + "/ca/admin/ca/getCookie", content, null); + + return getContentValue(response, "header.session_id"); + } + public static String getContentValue(String body, String header) { StringTokenizer st = new StringTokenizer(body, "\n"); -- cgit