summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/cert
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2014-05-02 19:16:03 -0400
committerAbhishek Koneru <akoneru@redhat.com>2014-05-16 14:18:44 -0400
commite491cd5625968cf3d837e83f9f388014b446de97 (patch)
tree1a2b0e184b1af1fb2c5119c15140b0275451c154 /base/common/src/com/netscape/certsrv/cert
parent2e4c0d19778fd12770ce79839ff928659d39bedc (diff)
downloadpki-e491cd5625968cf3d837e83f9f388014b446de97.tar.gz
pki-e491cd5625968cf3d837e83f9f388014b446de97.tar.xz
pki-e491cd5625968cf3d837e83f9f388014b446de97.zip
Removed requestID parameter usage in [un]revoke request.
There seems to be no use of the requestID parameter in both revoke and unrevoke request. Removed requestID attribute in CertRevokeRequest remove the class CertUnrevokeRequest. Also made changes in RevocationProcesor to use the requestID of the request created in it. The setRequestID() is being called in the DoRevoke and DoUnRevoke servlets. Removed the call and a function auditRequesterId in both the classes. The auditRequestorId method tries to get a "requestID" stored as a INPUT field in the reasonToRequest page. The ReasonToRevoke class which generates this page does not set the value.
Diffstat (limited to 'base/common/src/com/netscape/certsrv/cert')
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertClient.java4
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertResource.java2
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertRevokeRequest.java21
-rw-r--r--base/common/src/com/netscape/certsrv/cert/CertUnrevokeRequest.java124
4 files changed, 3 insertions, 148 deletions
diff --git a/base/common/src/com/netscape/certsrv/cert/CertClient.java b/base/common/src/com/netscape/certsrv/cert/CertClient.java
index 3af93269f..86e5e1537 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertClient.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertClient.java
@@ -75,8 +75,8 @@ public class CertClient extends Client {
return client.getEntity(response, CertRequestInfo.class);
}
- public CertRequestInfo unrevokeCert(CertId id, CertUnrevokeRequest request) {
- Response response = certClient.unrevokeCert(id, request);
+ public CertRequestInfo unrevokeCert(CertId id) {
+ Response response = certClient.unrevokeCert(id);
return client.getEntity(response, CertRequestInfo.class);
}
diff --git a/base/common/src/com/netscape/certsrv/cert/CertResource.java b/base/common/src/com/netscape/certsrv/cert/CertResource.java
index c5a5823ea..9d6a7c89b 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertResource.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertResource.java
@@ -65,5 +65,5 @@ public interface CertResource {
@ClientResponseType(entityType=CertRequestInfo.class)
@ACLMapping("certs")
@AuthMethodMapping("certs")
- public Response unrevokeCert(@PathParam("id") CertId id, CertUnrevokeRequest request);
+ public Response unrevokeCert(@PathParam("id") CertId id);
}
diff --git a/base/common/src/com/netscape/certsrv/cert/CertRevokeRequest.java b/base/common/src/com/netscape/certsrv/cert/CertRevokeRequest.java
index 0fe0c4696..a89c95a3e 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertRevokeRequest.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertRevokeRequest.java
@@ -34,8 +34,6 @@ import netscape.security.x509.RevocationReason;
import netscape.security.x509.RevocationReasonAdapter;
import com.netscape.certsrv.request.IRequest;
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.certsrv.request.RequestIdAdapter;
import com.netscape.certsrv.util.DateAdapter;
/**
@@ -58,7 +56,6 @@ public class CertRevokeRequest {
}
}
- RequestId requestID;
RevocationReason reason;
Date invalidityDate;
String comments;
@@ -66,17 +63,6 @@ public class CertRevokeRequest {
Long nonce;
- @XmlElement(name="RequestID")
- @FormParam("requestId")
- @XmlJavaTypeAdapter(RequestIdAdapter.class)
- public RequestId getRequestID() {
- return requestID;
- }
-
- public void setRequestID(RequestId requestID) {
- this.requestID = requestID;
- }
-
@XmlElement(name="Reason")
@FormParam("revocationReason")
@XmlJavaTypeAdapter(RevocationReasonAdapter.class)
@@ -138,7 +124,6 @@ public class CertRevokeRequest {
result = prime * result + ((invalidityDate == null) ? 0 : invalidityDate.hashCode());
result = prime * result + ((nonce == null) ? 0 : nonce.hashCode());
result = prime * result + ((reason == null) ? 0 : reason.hashCode());
- result = prime * result + ((requestID == null) ? 0 : requestID.hashCode());
return result;
}
@@ -176,11 +161,6 @@ public class CertRevokeRequest {
return false;
} else if (!reason.equals(other.reason))
return false;
- if (requestID == null) {
- if (other.requestID != null)
- return false;
- } else if (!requestID.equals(other.requestID))
- return false;
return true;
}
@@ -206,7 +186,6 @@ public class CertRevokeRequest {
public static void main(String args[]) throws Exception {
CertRevokeRequest before = new CertRevokeRequest();
- before.setRequestID(new RequestId("42323234"));
before.setReason(RevocationReason.CERTIFICATE_HOLD);
before.setInvalidityDate(new Date());
before.setComments("test");
diff --git a/base/common/src/com/netscape/certsrv/cert/CertUnrevokeRequest.java b/base/common/src/com/netscape/certsrv/cert/CertUnrevokeRequest.java
deleted file mode 100644
index 7885482be..000000000
--- a/base/common/src/com/netscape/certsrv/cert/CertUnrevokeRequest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// --- 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) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.certsrv.cert;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.ws.rs.FormParam;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.certsrv.request.RequestIdAdapter;
-
-/**
- * @author Endi S. Dewata
- */
-@XmlRootElement(name="CertUnrevokeRequest")
-public class CertUnrevokeRequest {
-
- public static Marshaller marshaller;
- public static Unmarshaller unmarshaller;
-
- static {
- try {
- JAXBContext context = JAXBContext.newInstance(CertUnrevokeRequest.class);
- marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- unmarshaller = context.createUnmarshaller();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- RequestId requestID;
-
- @XmlElement(name="requestID")
- @FormParam("requestId")
- @XmlJavaTypeAdapter(RequestIdAdapter.class)
- public RequestId getRequestID() {
- return requestID;
- }
-
- public void setRequestID(RequestId requestID) {
- this.requestID = requestID;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((requestID == null) ? 0 : requestID.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- CertUnrevokeRequest other = (CertUnrevokeRequest) obj;
- if (requestID == null) {
- if (other.requestID != null)
- return false;
- } else if (!requestID.equals(other.requestID))
- return false;
- return true;
- }
-
- public String toString() {
- try {
- StringWriter sw = new StringWriter();
- marshaller.marshal(this, sw);
- return sw.toString();
-
- } catch (Exception e) {
- return super.toString();
- }
- }
-
- public static CertUnrevokeRequest valueOf(String string) throws Exception {
- try {
- return (CertUnrevokeRequest)unmarshaller.unmarshal(new StringReader(string));
- } catch (Exception e) {
- return null;
- }
- }
-
- public static void main(String args[]) throws Exception {
-
- CertUnrevokeRequest before = new CertUnrevokeRequest();
- before.setRequestID(new RequestId("42323234"));
-
- String string = before.toString();
- System.out.println(string);
-
- CertUnrevokeRequest after = CertUnrevokeRequest.valueOf(string);
-
- System.out.println(before.equals(after));
- }
-}