diff options
author | Fraser Tweedale <ftweedal@redhat.com> | 2015-06-10 03:02:35 -0400 |
---|---|---|
committer | Fraser Tweedale <ftweedal@redhat.com> | 2015-09-26 14:11:51 +1000 |
commit | 5cdad30b99d8c115f6b50c63bb2ecceefdd33937 (patch) | |
tree | 46525eeadf64a22b5b0070176716d08ce5df36b9 /base/common/src/com/netscape/certsrv/authority | |
parent | 2a9f56d02b4a284cda6f8b61b250e1494f19a83e (diff) | |
download | pki-5cdad30b99d8c115f6b50c63bb2ecceefdd33937.tar.gz pki-5cdad30b99d8c115f6b50c63bb2ecceefdd33937.tar.xz pki-5cdad30b99d8c115f6b50c63bb2ecceefdd33937.zip |
Lightweight CAs: add ca-authority CLI
Add CLI commands for creating, listing and showing lightweight CAs.
Part of: https://fedorahosted.org/pki/ticket/1213
Diffstat (limited to 'base/common/src/com/netscape/certsrv/authority')
-rw-r--r-- | base/common/src/com/netscape/certsrv/authority/AuthorityClient.java | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/authority/AuthorityClient.java b/base/common/src/com/netscape/certsrv/authority/AuthorityClient.java new file mode 100644 index 000000000..86de3352e --- /dev/null +++ b/base/common/src/com/netscape/certsrv/authority/AuthorityClient.java @@ -0,0 +1,62 @@ +//--- BEGIN COPYRIGHT BLOCK --- +//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 of the License. +// +//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., +//51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +//(C) 2015 Red Hat, Inc. +//All rights reserved. +//--- END COPYRIGHT BLOCK --- +package com.netscape.certsrv.authority; + +import java.net.URISyntaxException; +import java.util.List; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; + +import com.netscape.certsrv.client.Client; +import com.netscape.certsrv.client.PKIClient; + +/** + * @author Fraser Tweedale <ftweedal@redhat.com> + */ +public class AuthorityClient extends Client { + + public AuthorityResource proxy; + + public AuthorityClient(PKIClient client, String subsystem) throws URISyntaxException { + super(client, subsystem, "authority"); + proxy = createProxy(AuthorityResource.class); + } + + public List<AuthorityData> listCAs() { + Response response = proxy.listCAs(); + GenericType<List<AuthorityData>> type = new GenericType<List<AuthorityData>>() {}; + return client.getEntity(response, type); + } + + public AuthorityData getCA(String caIDString) { + Response response = proxy.getCA(caIDString); + return client.getEntity(response, AuthorityData.class); + } + + public AuthorityData createCA(AuthorityData data) { + Response response = proxy.createCA(data); + return client.getEntity(response, AuthorityData.class); + } + + public AuthorityData modifyCA(AuthorityData data) { + Response response = proxy.modifyCA(data.getID(), data); + return client.getEntity(response, AuthorityData.class); + } + +} |