mirror of https://github.com/apache/cloudstack.git
Finalize custom certficate support. hook with UI
This commit is contained in:
parent
7255d68875
commit
160b2e1114
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
//
|
||||
package com.cloud.consoleproxy;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -644,9 +644,19 @@
|
|||
<ol>
|
||||
<li>
|
||||
<label><fmt:message key="label.certificate"/>:</label>
|
||||
<textarea class="text" name="update_cert" id="update_cert" style="height: 300px; width: 400px" />
|
||||
<textarea class="text" name="update_cert" id="update_cert" style="height: 200px; width: 400px" />
|
||||
<div id="update_cert_errormsg" class="dialog_formcontent_errormsg" style="display:none; width:300px" ></div>
|
||||
</li>
|
||||
<li>
|
||||
<label><fmt:message key="label.privatekey"/>:</label>
|
||||
<textarea class="text" name="update_privatekey" id="update_privatekey" style="height: 150px; width: 400px" />
|
||||
<div id="update_key_errormsg" class="dialog_formcontent_errormsg" style="display:none; width:300px" ></div>
|
||||
</li>
|
||||
<li>
|
||||
<label><fmt:message key="label.domain.suffix"/>:</label>
|
||||
<input class="text" name="update_domainsuffix" id="update_domainsuffix" style="width: 400px" />
|
||||
<div id="update_domainsuffix_errormsg" class="dialog_formcontent_errormsg" style="display:none; width:300px" ></div>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1596,14 +1596,18 @@ function initUpdateConsoleCertButton($midMenuAddLink2) {
|
|||
|
||||
var isValid = true;
|
||||
isValid &= validateString("SSL Certificate", $thisDialog.find("#update_cert"), $thisDialog.find("#update_cert_errormsg"), false, 4096);
|
||||
isValid &= validateString("Private Key for Certificate", $thisDialog.find("#update_privatekey"), $thisDialog.find("#update_key_errormsg"), false, 4096);
|
||||
isValid &= validateString("DNS domain suffix that certificate has been signed for", $thisDialog.find("#update_domainsuffix"), $thisDialog.find("#update_domainsuffix_errormsg"), false, 4096);
|
||||
if (!isValid) return;
|
||||
|
||||
$spinningWheel = $thisDialog.find("#spinning_wheel").show();
|
||||
|
||||
var cert = trim($thisDialog.find("#update_cert").val());
|
||||
var privateKey = trim($thisDialog.find("#update_privatekey").val());
|
||||
var domainSuffix = trim($thisDialog.find("#update_domainsuffix").val());
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=uploadCustomCertificate&certificate="+todb(cert)),
|
||||
data: createURL("command=uploadCustomCertificate&certificate="+todb(cert)+"&privatekey="+todb(privateKey)+"&domainsuffix="+todb(domainSuffix)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json.uploadcustomcertificateresponse.jobid;
|
||||
|
|
|
|||
Loading…
Reference in New Issue