diff options
author | Ade Lee <alee@redhat.com> | 2013-11-05 15:42:35 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2013-11-06 11:51:21 -0500 |
commit | 48fb4f11b8696194d06f7a7e57d57b7f3d11e00c (patch) | |
tree | 95ea83b29f9963df204f0957edce93bc0b0ccfc4 /base/common/src | |
parent | cbb907afcad95284503eaf6bdb00ee3c50047960 (diff) | |
download | pki-48fb4f11b8696194d06f7a7e57d57b7f3d11e00c.tar.gz pki-48fb4f11b8696194d06f7a7e57d57b7f3d11e00c.tar.xz pki-48fb4f11b8696194d06f7a7e57d57b7f3d11e00c.zip |
Fix KeyRequest and Key Resources to return correct exit codes
Also added some missing checks, and some missing options in the Key Request CLI
Diffstat (limited to 'base/common/src')
-rw-r--r-- | base/common/src/com/netscape/certsrv/key/KeyRequestResource.java | 15 | ||||
-rw-r--r-- | base/common/src/com/netscape/certsrv/kra/KRAClient.java | 12 |
2 files changed, 19 insertions, 8 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java index 6fc12d5ee..b7bea7057 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java @@ -9,6 +9,9 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; + +import org.jboss.resteasy.annotations.ClientResponseType; import com.netscape.certsrv.acls.ACLMapping; import com.netscape.certsrv.authentication.AuthMethodMapping; @@ -48,28 +51,32 @@ public interface KeyRequestResource { // Archiving - used to test integration with a browser @POST @Path("archive") + @ClientResponseType(entityType=KeyRequestInfo.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_FORM_URLENCODED}) - public KeyRequestInfo archiveKey(MultivaluedMap<String, String> form); + public Response archiveKey(MultivaluedMap<String, String> form); @POST @Path("archive") + @ClientResponseType(entityType=KeyRequestInfo.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo archiveKey(KeyArchivalRequest data); + public Response archiveKey(KeyArchivalRequest data); //Recovery - used to test integration with a browser @POST @Path("recover") + @ClientResponseType(entityType=KeyRequestInfo.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_FORM_URLENCODED}) - public KeyRequestInfo recoverKey(MultivaluedMap<String, String> form); + public Response recoverKey(MultivaluedMap<String, String> form); @POST @Path("recover") + @ClientResponseType(entityType=KeyRequestInfo.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo recoverKey(KeyRecoveryRequest data); + public Response recoverKey(KeyRecoveryRequest data); @POST @Path("{id}/approve") diff --git a/base/common/src/com/netscape/certsrv/kra/KRAClient.java b/base/common/src/com/netscape/certsrv/kra/KRAClient.java index 658aba50b..73ad56454 100644 --- a/base/common/src/com/netscape/certsrv/kra/KRAClient.java +++ b/base/common/src/com/netscape/certsrv/kra/KRAClient.java @@ -75,8 +75,10 @@ public class KRAClient extends SubsystemClient { data.setClientId(clientId); data.setDataType(dataType); - KeyRequestInfo info = keyRequestClient.archiveKey(data); - return info; + @SuppressWarnings("unchecked") + ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>) + keyRequestClient.archiveKey(data); + return client.getEntity(response); } public KeyDataInfo getKeyData(String clientId, String status) { @@ -109,8 +111,10 @@ public class KRAClient extends SubsystemClient { data.setNonceData(Utils.base64encode(nonceData)); } - KeyRequestInfo info = keyRequestClient.recoverKey(data); - return info; + @SuppressWarnings("unchecked") + ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>) + keyRequestClient.recoverKey(data); + return client.getEntity(response); } public void approveRecovery(RequestId recoveryId) { |