From 160b2e111477a6827272ba585a5afcce8d53507a Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 22 Apr 2011 13:45:00 -0700 Subject: [PATCH] Finalize custom certficate support. hook with UI --- .../api/commands/UploadCustomCertificateCmd.java | 4 ++-- .../api/response/CustomCertificateResponse.java | 13 ++++++------- .../WEB-INF/classes/resources/messages.properties | 2 ++ .../src/com/cloud/consoleproxy/ConsoleProxy.java | 1 - .../src/com/cloud/keystore/KeystoreManagerImpl.java | 2 +- .../src/com/cloud/server/ManagementServerImpl.java | 2 +- ui/jsp/resource.jsp | 12 +++++++++++- ui/scripts/cloud.core.resource.js | 6 +++++- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/api/src/com/cloud/api/commands/UploadCustomCertificateCmd.java b/api/src/com/cloud/api/commands/UploadCustomCertificateCmd.java index 1db7fcb7901..5511a54d1b4 100644 --- a/api/src/com/cloud/api/commands/UploadCustomCertificateCmd.java +++ b/api/src/com/cloud/api/commands/UploadCustomCertificateCmd.java @@ -83,10 +83,10 @@ public class UploadCustomCertificateCmd extends BaseAsyncCmd { @Override public void execute(){ String result = _mgr.uploadCertificate(this); - if (result != null){ + if (result != null) { CustomCertificateResponse response = new CustomCertificateResponse(); response.setResponseName(getCommandName()); - response.setUpdatedConsoleProxyIdList(result); + response.setResultMessage(result); response.setObjectName("customcertificate"); this.setResponseObject(response); } else { diff --git a/api/src/com/cloud/api/response/CustomCertificateResponse.java b/api/src/com/cloud/api/response/CustomCertificateResponse.java index 3af020579fa..c3d939e087f 100644 --- a/api/src/com/cloud/api/response/CustomCertificateResponse.java +++ b/api/src/com/cloud/api/response/CustomCertificateResponse.java @@ -22,15 +22,14 @@ import com.google.gson.annotations.SerializedName; public class CustomCertificateResponse extends BaseResponse { - @SerializedName("updatedconsoleproxyidlist") @Param(description="the list of the console proxy ids which were successfully updated") - private String updatedConsoleProxyIdList; + @SerializedName("message") @Param(description="message of the certificate upload operation") + private String message; - public String getUpdatedConsoleProxyIdList() { - return updatedConsoleProxyIdList; + public String getResultMessage() { + return message; } - public void setUpdatedConsoleProxyIdList(String updatedConsoleProxyIdList) { - this.updatedConsoleProxyIdList = updatedConsoleProxyIdList; + public void setResultMessage(String msg) { + this.message = msg; } - } diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 555bbc8f929..ca2e4d64240 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -225,6 +225,8 @@ label.bytes.received=Bytes Received label.bytes.sent=Bytes Sent label.cancel=Cancel label.certificate=Certificate +label.privatekey=Private Key +label.domain.suffix=DNS Domain Suffix label.character=Character label.cidr.account=CIDR or Account/Security Group label.close=Close diff --git a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxy.java b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxy.java index 21ac9d54c57..99f60a549b4 100644 --- a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxy.java +++ b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxy.java @@ -15,7 +15,6 @@ * along with this program. If not, see . * */ -// package com.cloud.consoleproxy; import java.io.File; diff --git a/server/src/com/cloud/keystore/KeystoreManagerImpl.java b/server/src/com/cloud/keystore/KeystoreManagerImpl.java index 4b880e7edeb..6fa2a690cfc 100644 --- a/server/src/com/cloud/keystore/KeystoreManagerImpl.java +++ b/server/src/com/cloud/keystore/KeystoreManagerImpl.java @@ -76,7 +76,7 @@ public class KeystoreManagerImpl implements KeystoreManager { try { String ksPassword = "passwordForValidation"; - byte[] ksBits = CertificateHelper.buildAndSaveKeystore(domainSuffix, certificate, key, ksPassword); + byte[] ksBits = CertificateHelper.buildAndSaveKeystore(domainSuffix, certificate, getKeyContent(key), ksPassword); KeyStore ks = CertificateHelper.loadKeystore(ksBits, ksPassword); if(ks != null) return true; diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 2ba0e556e30..46219461b85 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -4564,7 +4564,7 @@ public class ManagementServerImpl implements ManagementServer { _ksMgr.saveCertificate(ConsoleProxyManager.CERTIFICATE_NAME, cmd.getCertificate(), cmd.getPrivateKey(), cmd.getDomainSuffix()); _consoleProxyMgr.setManagementState(ConsoleProxyManagementState.ResetSuspending); - return "Certificate has been updated, we will stop all running console proxy VMs for certificate propagation"; + return "Certificate has been updated, we will stop all running console proxy VMs to propagate the new certificate, please give a few minutes for console access service to be up again"; } @Override diff --git a/ui/jsp/resource.jsp b/ui/jsp/resource.jsp index a5a799c95cb..676d828e7ba 100644 --- a/ui/jsp/resource.jsp +++ b/ui/jsp/resource.jsp @@ -644,9 +644,19 @@
  1. -