Commit e865bec1 authored by Bill Lynch's avatar Bill Lynch Committed by bill

Implemented deleting


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@367 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1f63ccd2
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
String cert = ParamUtils.getParameter(request, "cert"); String cert = ParamUtils.getParameter(request, "cert");
String alias = ParamUtils.getParameter(request, "alias"); String alias = ParamUtils.getParameter(request, "alias");
boolean install = request.getParameter("install") != null; boolean install = request.getParameter("install") != null;
boolean uninstall = ParamUtils.getBooleanParameter(request,"uninstall");
KeyStore keyStore = SSLConfig.getKeyStore(); KeyStore keyStore = SSLConfig.getKeyStore();
KeyStore trustStore = SSLConfig.getTrustStore(); KeyStore trustStore = SSLConfig.getTrustStore();
...@@ -67,6 +68,25 @@ ...@@ -67,6 +68,25 @@
} }
} }
} }
if (uninstall) {
if (type != null && alias != null) {
try {
if ("client".equals(type)){
SSLConfig.getTrustStore().deleteEntry(alias);
}
else if ("server".equals(type)) {
SSLConfig.getKeyStore().deleteEntry(alias);
}
SSLConfig.saveStores();
response.sendRedirect("ssl-settings.jsp?deletesuccess=true");
return;
}
catch (Exception e) {
e.printStackTrace();
errors.put("delete", e);
}
}
}
%> %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" /> <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
...@@ -93,6 +113,37 @@ ...@@ -93,6 +113,37 @@
</table> </table>
</div><br> </div><br>
<% } else if (ParamUtils.getBooleanParameter(request,"deletesuccess")) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
Certificate uninstalled successfully.
</td></tr>
</tbody>
</table>
</div><br>
<% } else if (errors.containsKey("delete")) {
Exception e = (Exception)errors.get("delete");
%>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
Error uninstalling the certificate.
<% if (e != null && e.getMessage() != null) { %>
Error message: <%= e.getMessage() %>
<% } %>
</td></tr>
</tbody>
</table>
</div><br>
<% } else if (errors.size() > 0) { %> <% } else if (errors.size() > 0) { %>
<div class="jive-error"> <div class="jive-error">
...@@ -120,14 +171,14 @@ install a new certificate. ...@@ -120,14 +171,14 @@ install a new certificate.
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead> <thead>
<tr> <tr>
<th>&nbsp;</th> <th width="1%">&nbsp;</th>
<th> <th>
Alias (host) Alias (host)
</th> </th>
<th> <th>
Certificate Type Certificate Type
</th> </th>
<th> <th width="1%">
Uninstall Uninstall
</th> </th>
</tr> </tr>
...@@ -149,8 +200,9 @@ install a new certificate. ...@@ -149,8 +200,9 @@ install a new certificate.
<%= c.getType() %> <%= c.getType() %>
</td> </td>
<td width="1" align="center"> <td width="1" align="center">
<a href="ssl-delete.jsp?alias=<%= a %>&type=server" <a href="ssl-settings.jsp?alias=<%= a %>&type=server&uninstall=true"
title="Click to uninstall..." title="Click to uninstall..."
onclick="return confirm('Are you sure you want to uninstall this certificate?');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a> ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td> </td>
</tr> </tr>
...@@ -166,6 +218,18 @@ install a new certificate. ...@@ -166,6 +218,18 @@ install a new certificate.
<% } %> <% } %>
<% if (i==0) { %>
<tr>
<td colspan="4">
<p>
No certificates installed. Use the form below to install one.
</p>
</td>
</tr>
<% } %>
</tbody> </tbody>
</table> </table>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment