summaryrefslogtreecommitdiffstats
path: root/install/static/test
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-10-07 14:02:44 -0500
committerAdam Young <ayoung@redhat.com>2010-10-12 14:17:24 -0400
commit1dc0a3ab3e145e0f8fdfd71a1205b546a906bd51 (patch)
tree767a8e704b54f7ef25ad8eac6713d2cd1caa9e8c /install/static/test
parent81fe26bdcfdfc1673d4c499eaa1183be1ccee281 (diff)
downloadfreeipa-1dc0a3ab3e145e0f8fdfd71a1205b546a906bd51.tar.gz
freeipa-1dc0a3ab3e145e0f8fdfd71a1205b546a906bd51.tar.xz
freeipa-1dc0a3ab3e145e0f8fdfd71a1205b546a906bd51.zip
Certificate management for services.
This is an initial implementation of certificate management for services. It addresses the mechanism required to view and update certificates. The complete UI implementation will be addressed in subsequent patches. On the server side, the service.py has been modified to define usercertificate in the service object's takes_params. This is needed to generate the proper JSON metadata which is needed by the UI. It also has been modified to accept null certificate for deletion. On the client side, the service details page has been modified to display the base64-encoded certificate in a text area. When the page is saved, the action handler will store the base64-encoded certificate in the proper JSON structure. Also the service name and service hostname are now displayed in separate fields. The details configuration has been modified to support displaying and updating certificates. The structure is changed to use maps to define sections and fields. A section contains name, label, and an array of fields. A field contains name, label, setup function, load function, and save function. This is used to implement custom interface and behavior for certificates. All other entities, test cases, and test data have been updated accordingly. Some functions and variables have been renamed to improve clarity and consistency.
Diffstat (limited to 'install/static/test')
-rw-r--r--install/static/test/data/json_metadata.json25
-rw-r--r--install/static/test/data/service_mod.json21
-rw-r--r--install/static/test/data/service_show.json5
-rw-r--r--install/static/test/details_tests.js83
4 files changed, 101 insertions, 33 deletions
diff --git a/install/static/test/data/json_metadata.json b/install/static/test/data/json_metadata.json
index 52be79882..4a732ac5f 100644
--- a/install/static/test/data/json_metadata.json
+++ b/install/static/test/data/json_metadata.json
@@ -2865,6 +2865,31 @@
"query": false,
"required": true,
"type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Bytes",
+ "cli_name": "certificate",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Base-64 encoded server certificate",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Certificate",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "usercertificate",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "str"
}
],
"uuid_attribute": "ipauniqueid"
diff --git a/install/static/test/data/service_mod.json b/install/static/test/data/service_mod.json
new file mode 100644
index 000000000..f56186466
--- /dev/null
+++ b/install/static/test/data/service_mod.json
@@ -0,0 +1,21 @@
+{
+ "error": null,
+ "id": 0,
+ "result": {
+ "result": {
+ "krbprincipalname": [
+ "test/dev.example.com@DEV.EXAMPLE.COM"
+ ],
+ "managedby_host": [
+ "dev.example.com"
+ ],
+ "usercertificate": [
+ {
+ "__base64__": "MIICAjCCAWugAwIBAgICBAswDQYJKoZIhvcNAQEFBQAwKTEnMCUGA1UEAxMeSVBBIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTEwMTAwNzIzMzk0NFoXDTE1MTAwNzIzMzk0NFowKDEMMAoGA1UECgwDSVBBMRgwFgYDVQQDDA9kZXYuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOTXyj8grVB7Rj95RFawgdwn9OYZ03LWHZ+HMYggu2/xCCrUrdThP14YBlVqZumjVJSclj6T4ACjjdPJq9JTTmx7gMizDTReus7IPlS6fCxb5v5whQJZsEksXL04OxUMl25euPRFkYcTK1rdW47+AkG10j1qeNW+B6CpdQGR6eM/AgMBAAGjOjA4MBEGCWCGSAGG+EIBAQQEAwIGQDATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCBPAwDQYJKoZIhvcNAQEFBQADgYEASIhq723VL5xP0q51MYXFlGU1boD7pPD1pIQspD/MjCIEupcbH2kAo4wf+EiKsXR0rs+WZkaSgvFqaM4OQ2kWSFTiqmFXFDBEi6EFr68yLg7IpQpNTzVBXERd8B4GwNL9wrRw60jPXlUK29DPBsdGq8fDgX18l39wKkWXv7p1to4="
+ }
+ ]
+ },
+ "summary": "Modified service \"test/dev.example.com@DEV.EXAMPLE.COM\"",
+ "value": "test/dev.example.com@DEV.EXAMPLE.COM"
+ }
+} \ No newline at end of file
diff --git a/install/static/test/data/service_show.json b/install/static/test/data/service_show.json
index 30025eb76..7ab778e18 100644
--- a/install/static/test/data/service_show.json
+++ b/install/static/test/data/service_show.json
@@ -10,6 +10,11 @@
],
"managedby_host": [
"dev.example.com"
+ ],
+ "usercertificate": [
+ {
+ "__base64__": "MIICAjCCAWugAwIBAgICBAswDQYJKoZIhvcNAQEFBQAwKTEnMCUGA1UEAxMeSVBBIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTEwMTAwNzIzMzk0NFoXDTE1MTAwNzIzMzk0NFowKDEMMAoGA1UECgwDSVBBMRgwFgYDVQQDDA9kZXYuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOTXyj8grVB7Rj95RFawgdwn9OYZ03LWHZ+HMYggu2/xCCrUrdThP14YBlVqZumjVJSclj6T4ACjjdPJq9JTTmx7gMizDTReus7IPlS6fCxb5v5whQJZsEksXL04OxUMl25euPRFkYcTK1rdW47+AkG10j1qeNW+B6CpdQGR6eM/AgMBAAGjOjA4MBEGCWCGSAGG+EIBAQQEAwIGQDATBgNVHSUEDDAKBggrBgEFBQcDATAOBgNVHQ8BAf8EBAMCBPAwDQYJKoZIhvcNAQEFBQADgYEASIhq723VL5xP0q51MYXFlGU1boD7pPD1pIQspD/MjCIEupcbH2kAo4wf+EiKsXR0rs+WZkaSgvFqaM4OQ2kWSFTiqmFXFDBEi6EFr68yLg7IpQpNTzVBXERd8B4GwNL9wrRw60jPXlUK29DPBsdGq8fDgX18l39wKkWXv7p1to4="
+ }
]
},
"summary": null,
diff --git a/install/static/test/details_tests.js b/install/static/test/details_tests.js
index ee5d3961e..1a7efc10b 100644
--- a/install/static/test/details_tests.js
+++ b/install/static/test/details_tests.js
@@ -22,26 +22,37 @@
test("Testing ipa_details_create().", function() {
- var details = [
- ['identity', 'Entity Details', [
- ['cn', 'Entity Name'],
- ['description', 'Description'],
- ['number', 'Entity ID']
- ]]
+ var fields = [
+ {name:'cn', label:'Entity Name'},
+ {name:'description', label:'Description'},
+ {name:'number', label:'Entity ID'}
];
- var identity = details[0];
- var attrs=identity[2];
+ var sections = [
+ {name:'identity', label:'Entity Details', fields:fields}
+ ];
+
+ var identity = sections[0];
var key = 'entity';
- var container = $("<div/>",{id: "container"});
- ipa_details_create(key, details, container)
+ var container = $("<div/>",{id: key});
+ ipa_details_create(container, sections);
- same(container[0].title,key);
+ same(
+ container[0].title, key,
+ "Checking container name"
+ );
+
var dl = container.find('dl#identity');
- ok(dl );
+ ok(
+ dl,
+ "Checking section"
+ );
- same(dl[0].children.length, attrs.length);
+ same(
+ dl[0].children.length, fields.length,
+ "Checking fields"
+ );
});
@@ -60,33 +71,39 @@ test("Testing _ipa_create_text_input().", function(){
-test("Testing ipa_generate_dl()",function(){
+test("Testing ipa_details_section_setup()",function(){
- var details = [
- ['cn', 'Entity Name'],
- ['description', 'Description'],
- ['number', 'Entity ID']
+ var fields = [
+ {name:'cn', label:'Entity Name'},
+ {name:'description', label:'Description'},
+ {name:'number', label:'Entity ID'}
];
- var name = 'NAMENAMENAME';
- var identity = 'IDIDID';
- var parent = $("<div/>");
- var jobj = $("<div title='entity'/>");
- parent.append(jobj);
- ipa_generate_dl(jobj, identity,name, details);
- ok(parent.find('hr'));
+ var section = {
+ name: 'IDIDID',
+ label: 'NAMENAMENAME',
+ fields: fields
+ };
+
+ var container = $("<div title='entity'/>");
+ var details = $("<div/>");
+ container.append(details);
+
+ ipa_details_section_setup(container, details, section);
+
+ ok(container.find('hr'));
- var h2= parent.find('h2');
+ var h2= container.find('h2');
ok(h2);
- ok(h2[0].innerHTML.indexOf(name) > 1,"find name in html");
+ ok(h2[0].innerHTML.indexOf(section.label) > 1,"find name in html");
- var dl = parent.find('dl');
+ var dl = container.find('dl');
ok(dl);
same(dl[0].children.length,3);
- same(dl[0].id, identity);
- same(dl[0].children[0].title,details[0][0]);
- same(dl[0].children[0].innerHTML,details[0][1]+":");
- same(dl[0].children[2].title,details[2][0]);
- same(dl[0].children[2].innerHTML,details[2][1]+":");
+ same(dl[0].id, section.name);
+ same(dl[0].children[0].title, fields[0].name);
+ same(dl[0].children[0].innerHTML, fields[0].label+":");
+ same(dl[0].children[2].title, fields[2].name);
+ same(dl[0].children[2].innerHTML, fields[2].label+":");
}); \ No newline at end of file