From 4c24581b5cffaffbb200152e1d43931c0d674102 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Fri, 15 Oct 2010 12:22:01 -0500 Subject: [PATCH] Service certificate UI. The service.py has been modified to include certificate info in the service-show result if the service contains usercertificate. A new file certificate.js has been added to store codes related to certificates (e.g. revocation reasons, dialog boxes). The service.js has been modified to provide the UI for certificate management. The certificate.js can also be used for host certificate management. The Makefile.am and index.xhtml has been modified to include certificate.js. New test data files have been added for certificate operations. To test revoke and restore operations the server needs to be installed with dogtag CA instead of self-signed CA. The certificate status and revocation reason in the details page will be implemented in subsequent patches. Unit tests will also be added in subsequent patches. --- install/static/Makefile.am | 1 + install/static/certificate.js | 381 ++++++++++++++++++ install/static/index.xhtml | 1 + install/static/service.js | 262 ++++++++++-- .../static/test/data/cert_remove_hold.json | 9 + install/static/test/data/cert_request.json | 17 + install/static/test/data/cert_revoke.json | 9 + install/static/test/data/json_metadata.json | 176 +++++++- install/static/test/data/service_show.json | 9 +- ipalib/plugins/service.py | 41 +- 10 files changed, 867 insertions(+), 39 deletions(-) create mode 100755 install/static/certificate.js create mode 100644 install/static/test/data/cert_remove_hold.json create mode 100644 install/static/test/data/cert_request.json create mode 100644 install/static/test/data/cert_revoke.json diff --git a/install/static/Makefile.am b/install/static/Makefile.am index 8071d25f1..ee8384c7b 100644 --- a/install/static/Makefile.am +++ b/install/static/Makefile.am @@ -20,6 +20,7 @@ app_DATA = \ jquery-ui.js \ jquery.ba-bbq.js \ jquery-ui.css \ + certificate.js \ group.js \ host.js \ hostgroup.js \ diff --git a/install/static/certificate.js b/install/static/certificate.js new file mode 100755 index 000000000..4302e2f81 --- /dev/null +++ b/install/static/certificate.js @@ -0,0 +1,381 @@ +/* Authors: + * Endi Sukma Dewata + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +var BEGIN_CERTIFICATE_REQUEST = '-----BEGIN CERTIFICATE REQUEST-----'; +var END_CERTIFICATE_REQUEST = '-----END CERTIFICATE REQUEST-----'; + +var CRL_REASON = [ + 'Unspecified', + 'Key Compromise', + 'CA Compromise', + 'Affiliation Changed', + 'Superseded', + 'Cessation of Operation', + 'Certificate Hold', + null, + 'Remove from CRL', + 'Privilege Withdrawn', + 'AA Compromise' +]; + +function certificate_parse_dn(dn) { + + var result = {}; + + // TODO: Use proper LDAP DN parser + var rdns = dn.split(','); + for (var i=0; i', { + 'title': spec.title + }); + + dialog.append(spec.message); + + that.open = function() { + dialog.dialog({ + modal: true, + width: 300, + height: 150, + buttons: { + 'Close': function() { + dialog.dialog('destroy'); + } + } + }); + }; + + return that; +} + +function certificate_get_dialog(spec) { + var that = {}; + spec = spec || {}; + + var dialog = $('
', { + 'title': spec.title + }); + + var textarea = $('