[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 0144..0146 Move IRequest extdata-related constants



The attached patches relocate / redefine some constants that are
used as keys when setting or getting IRequest extdata attributes.

In some cases this removes duplicate constants or string literals.
In other cases it actually defines a new constant.
In all cases the key now uses a constant defined in IRequest, which
is the appropriate place.

This is refactoring work undertaken as part of GSSAPI support.

Thanks,
Fraser
From 31d9026f2be5204dd4742ce00542bc80b614d9b9 Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftweedal redhat com>
Date: Wed, 7 Dec 2016 12:25:01 +1000
Subject: [PATCH 144/146] Define "auth_token" IRequest extdata key prefix in
 one place

Part of: https://fedorahosted.org/pki/ticket/1359
---
 base/common/src/com/netscape/certsrv/request/IRequest.java   |  4 ++++
 .../cms/src/com/netscape/cms/servlet/cert/CertProcessor.java |  9 +++++++--
 .../src/com/netscape/cms/servlet/processors/CAProcessor.java |  1 -
 .../cms/servlet/profile/ProfileSubmitCMCServlet.java         | 12 +++++++-----
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/request/IRequest.java b/base/common/src/com/netscape/certsrv/request/IRequest.java
index c892dbb1dc5d75d4b44e4e26b584f94717b2457c..f17f560de75e54cb7650ee06d870f3d1491e52ac 100644
--- a/base/common/src/com/netscape/certsrv/request/IRequest.java
+++ b/base/common/src/com/netscape/certsrv/request/IRequest.java
@@ -85,6 +85,10 @@ public interface IRequest extends Serializable {
     // server attributes: attributes generated by server modules.
     public static final String SERVER_ATTRS = "SERVER_ATTRS";
 
+    // Sometimes individual IAuthToken fields get set in request
+    // extdata, with key ("auth_token." + field_name).
+    public static final String AUTH_TOKEN_PREFIX = "auth_token";
+
     public static final String RESULT = "Result"; // service result.
     public static final Integer RES_SUCCESS = Integer.valueOf(1); // result value
     public static final Integer RES_ERROR = Integer.valueOf(2); // result value
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
index 17b453ab5d82bd7c18612263f01e297a4e9df3da..cb5efa0b0e14274e0c4a9393522ab18071f60fd8 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
@@ -310,12 +310,17 @@ public class CertProcessor extends CAProcessor {
                     String[] tokenVals = authToken.getInStringArray(tokenName);
                     if (tokenVals != null) {
                         for (int i = 0; i < tokenVals.length; i++) {
-                            req.setExtData(ARG_AUTH_TOKEN + "." + tokenName + "[" + i + "]", tokenVals[i]);
+                            req.setExtData(
+                                IRequest.AUTH_TOKEN_PREFIX
+                                    + "." + tokenName + "[" + i + "]"
+                                , tokenVals[i]);
                         }
                     } else {
                         String tokenVal = authToken.getInString(tokenName);
                         if (tokenVal != null) {
-                            req.setExtData(ARG_AUTH_TOKEN + "." + tokenName, tokenVal);
+                            req.setExtData(
+                                IRequest.AUTH_TOKEN_PREFIX + "." + tokenName,
+                                tokenVal);
                             // if RA agent, auto assign the request
                             if (tokenName.equals("uid"))
                                 uid = tokenVal;
diff --git a/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
index bb3cfa84a423fe452ef55fb20e23c03911831690..ae91f649541db5ce77679844ad7a4fec680e99e9 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
@@ -72,7 +72,6 @@ import netscape.security.x509.X509CertImpl;
 
 public class CAProcessor extends Processor {
 
-    public final static String ARG_AUTH_TOKEN = "auth_token";
     public final static String ARG_REQUEST_OWNER = "requestOwner";
     public final static String HDR_LANG = "accept-language";
     public final static String ARG_PROFILE = "profile";
diff --git a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java
index f3adc5e85e58e3fb2dbf47984cfeca6797cd569b..6191031905626cc7acb6ccbdc41ff84942baf86f 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileSubmitCMCServlet.java
@@ -76,7 +76,6 @@ public class ProfileSubmitCMCServlet extends ProfileServlet {
      *
      */
     private static final long serialVersionUID = -8017841111435988197L;
-    private static final String ARG_AUTH_TOKEN = "auth_token";
     private static final String PROP_PROFILE_ID = "profileId";
 
     private String mProfileId = null;
@@ -545,14 +544,17 @@ public class ProfileSubmitCMCServlet extends ProfileServlet {
                     String[] vals = authToken.getInStringArray(tokenName);
                     if (vals != null) {
                         for (int i = 0; i < vals.length; i++) {
-                            reqs[k].setExtData(ARG_AUTH_TOKEN + "." +
-                                    tokenName + "[" + i + "]", vals[i]);
+                            reqs[k].setExtData(
+                                IRequest.AUTH_TOKEN_PREFIX
+                                    + "." + tokenName + "[" + i + "]",
+                                vals[i]);
                         }
                     } else {
                         String val = authToken.getInString(tokenName);
                         if (val != null) {
-                            reqs[k].setExtData(ARG_AUTH_TOKEN + "." + tokenName,
-                                    val);
+                            reqs[k].setExtData(
+                                IRequest.AUTH_TOKEN_PREFIX + "." + tokenName,
+                                val);
                         }
                     }
                 }
-- 
2.7.4

From eb0c0fdf115639a5cf3ed9beb1ab2df0553e1627 Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftweedal redhat com>
Date: Wed, 7 Dec 2016 13:40:04 +1000
Subject: [PATCH 145/146] Define "profileId" IRequest extdata key in one place

Part of: https://fedorahosted.org/pki/ticket/1359
---
 base/ca/src/com/netscape/ca/CAService.java                          | 4 ++--
 base/ca/src/org/dogtagpki/legacy/ca/CAPolicy.java                   | 4 ++--
 base/common/src/com/netscape/certsrv/request/IRequest.java          | 2 ++
 base/kra/src/com/netscape/kra/EnrollmentService.java                | 6 +++---
 .../src/com/netscape/cms/listeners/CertificateIssuedListener.java   | 2 +-
 .../cms/src/com/netscape/cms/listeners/RequestInQListener.java      | 2 +-
 .../server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java | 2 +-
 .../cms/src/com/netscape/cms/servlet/cert/CertRequestDAO.java       | 2 +-
 .../cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java     | 2 +-
 .../cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java     | 4 ++--
 .../cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java   | 4 ++--
 .../src/com/netscape/cms/servlet/connector/ConnectorServlet.java    | 4 ++--
 .../cms/src/com/netscape/cms/servlet/processors/CAProcessor.java    | 1 -
 .../src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java | 2 +-
 .../src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java  | 2 +-
 .../cms/src/com/netscape/cms/servlet/request/CheckRequest.java      | 2 +-
 .../cmscore/src/com/netscape/cmscore/connector/RequestTransfer.java | 2 +-
 .../cmscore/src/com/netscape/cmscore/ldap/LdapRequestListener.java  | 2 +-
 .../org/dogtagpki/legacy/core/policy/GenericPolicyProcessor.java    | 2 +-
 19 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/base/ca/src/com/netscape/ca/CAService.java b/base/ca/src/com/netscape/ca/CAService.java
index 9bf237ffd7060c1955b8e163a0c94c62db6739b1..31df1537e337e669a5221c938b7454c72337d254 100644
--- a/base/ca/src/com/netscape/ca/CAService.java
+++ b/base/ca/src/com/netscape/ca/CAService.java
@@ -308,7 +308,7 @@ public class CAService implements ICAService, IService {
     }
 
     public boolean isProfileRequest(IRequest request) {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals(""))
             return false;
@@ -325,7 +325,7 @@ public class CAService implements ICAService, IService {
         CMS.debug("CAService: serviceProfileRequest requestId=" +
                 request.getRequestId().toString());
 
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals("")) {
             throw new EBaseException("profileId not found");
diff --git a/base/ca/src/org/dogtagpki/legacy/ca/CAPolicy.java b/base/ca/src/org/dogtagpki/legacy/ca/CAPolicy.java
index 75c2945882c7ce9c2fceb7228d848a7432ace7ae..878955e6e2b7b93714fb7906efe3c8658b0646d2 100644
--- a/base/ca/src/org/dogtagpki/legacy/ca/CAPolicy.java
+++ b/base/ca/src/org/dogtagpki/legacy/ca/CAPolicy.java
@@ -82,7 +82,7 @@ public class CAPolicy implements IPolicy {
     }
 
     public boolean isProfileRequest(IRequest request) {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals(""))
             return false;
@@ -110,7 +110,7 @@ public class CAPolicy implements IPolicy {
             CMS.debug("CAPolicy: requestId=" +
                     r.getRequestId().toString());
 
-            String profileId = r.getExtDataInString("profileId");
+            String profileId = r.getExtDataInString(IRequest.PROFILE_ID);
 
             if (profileId == null || profileId.equals("")) {
                 return PolicyResult.REJECTED;
diff --git a/base/common/src/com/netscape/certsrv/request/IRequest.java b/base/common/src/com/netscape/certsrv/request/IRequest.java
index f17f560de75e54cb7650ee06d870f3d1491e52ac..b83d5309e0b2aaf271cf4fba3c1ee7d13b347a58 100644
--- a/base/common/src/com/netscape/certsrv/request/IRequest.java
+++ b/base/common/src/com/netscape/certsrv/request/IRequest.java
@@ -89,6 +89,8 @@ public interface IRequest extends Serializable {
     // extdata, with key ("auth_token." + field_name).
     public static final String AUTH_TOKEN_PREFIX = "auth_token";
 
+    public static final String PROFILE_ID = "profileId";
+
     public static final String RESULT = "Result"; // service result.
     public static final Integer RES_SUCCESS = Integer.valueOf(1); // result value
     public static final Integer RES_ERROR = Integer.valueOf(2); // result value
diff --git a/base/kra/src/com/netscape/kra/EnrollmentService.java b/base/kra/src/com/netscape/kra/EnrollmentService.java
index 398d1780275f9106271f3c83e958d7e618febaf8..f901b5767d61e143c47ab23fad0595cff46d6421 100644
--- a/base/kra/src/com/netscape/kra/EnrollmentService.java
+++ b/base/kra/src/com/netscape/kra/EnrollmentService.java
@@ -195,7 +195,7 @@ public class EnrollmentService implements IService {
         byte tmp_unwrapped[] = null;
         PKIArchiveOptionsContainer aOpts[] = null;
 
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals("")) {
             try {
@@ -759,7 +759,7 @@ public class EnrollmentService implements IService {
      * @exception EBaseException failed to retrieve public key
      */
     private X509Key getPublicKey(IRequest request, int i) throws EBaseException {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId != null && !profileId.equals("")) {
             byte[] certKeyData = request.getExtDataInByteArray(IEnrollProfile.REQUEST_KEY);
@@ -822,7 +822,7 @@ public class EnrollmentService implements IService {
     private String getOwnerName(IRequest request, int i)
             throws EBaseException {
 
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId != null && !profileId.equals("")) {
             CertificateSubjectName sub = request.getExtDataInCertSubjectName(
diff --git a/base/server/cms/src/com/netscape/cms/listeners/CertificateIssuedListener.java b/base/server/cms/src/com/netscape/cms/listeners/CertificateIssuedListener.java
index 44ff46a9be2721ab01eda8b376de74302f4cb937..6d119e1336be1379ef79e63089aefbf172760f53 100644
--- a/base/server/cms/src/com/netscape/cms/listeners/CertificateIssuedListener.java
+++ b/base/server/cms/src/com/netscape/cms/listeners/CertificateIssuedListener.java
@@ -180,7 +180,7 @@ public class CertificateIssuedListener implements IRequestListener {
         CMS.debug("CertificateIssuedListener: accept check status ");
 
         // check if it is profile request
-        String profileId = r.getExtDataInString("profileId");
+        String profileId = r.getExtDataInString(IRequest.PROFILE_ID);
 
         // check if request failed.
         if (profileId == null) {
diff --git a/base/server/cms/src/com/netscape/cms/listeners/RequestInQListener.java b/base/server/cms/src/com/netscape/cms/listeners/RequestInQListener.java
index f1f396ca3343977fb9f2334d525d82ecf85a14b5..3c2c15123cae0cab674b3803b40d8fdfa0eafe0c 100644
--- a/base/server/cms/src/com/netscape/cms/listeners/RequestInQListener.java
+++ b/base/server/cms/src/com/netscape/cms/listeners/RequestInQListener.java
@@ -198,7 +198,7 @@ public class RequestInQListener implements IRequestListener {
                 mConfig.getName());
         Object val = null;
 
-        String profileId = r.getExtDataInString("profileId");
+        String profileId = r.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null) {
             val = r.getExtDataInString(IRequest.HTTP_PARAMS, "csrRequestorEmail");
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
index cb5efa0b0e14274e0c4a9393522ab18071f60fd8..026f4d4af5c2316ae8a93b2ecc62bc398d3b8b71 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/CertProcessor.java
@@ -339,7 +339,7 @@ public class CertProcessor extends CAProcessor {
 
             // put profile framework parameters into the request
             req.setExtData(ARG_PROFILE, "true");
-            req.setExtData(ARG_PROFILE_ID, profileId);
+            req.setExtData(IRequest.PROFILE_ID, profileId);
             if (isRenewal)
                 req.setExtData(ARG_RENEWAL_PROFILE_ID, data.getProfileId());
             req.setExtData(ARG_PROFILE_APPROVED_BY, profile.getApprovedBy());
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/CertRequestDAO.java b/base/server/cms/src/com/netscape/cms/servlet/cert/CertRequestDAO.java
index 306fbf570103daf09401faa0b615ae11f6b18953..93df6fb37949a9b40de9f427b1c3e7cf6fb5ef05 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/CertRequestDAO.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/CertRequestDAO.java
@@ -140,7 +140,7 @@ public class CertRequestDAO extends CMSRequestDAO {
         if (request == null) {
             return null;
         }
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
         IProfile profile = ps.getProfile(profileId);
         CertReviewResponse info = CertReviewResponseFactory.create(request, profile, uriInfo, locale);
 
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
index 206d23a5d7898af2e7e93f98080dfa8b009d07ef..01ffc8be43a90c428fa61e97a70cfe3d87b8710f 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
@@ -213,7 +213,7 @@ public class RenewalProcessor extends CertProcessor {
                 throw new EBaseException(CMS.getUserMessage(locale, "CMS_INTERNAL_ERROR"));
             }
 
-            String profileId = origReq.getExtDataInString("profileId");
+            String profileId = origReq.getExtDataInString(IRequest.PROFILE_ID);
             CMS.debug("RenewalSubmitter: renewal original profileId=" + profileId);
 
             String aidString = origReq.getExtDataInString(
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
index b92ffb1d7527178e38eeaa4e35b83940167e9f4d..7f0c89ce5fad8c334dd204188c3e9ce103c207bd 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
@@ -71,7 +71,7 @@ public class RequestProcessor extends CertProcessor {
         HttpServletRequest req = cmsReq.getHttpReq();
         IRequest ireq = cmsReq.getIRequest();
 
-        String profileId = ireq.getExtDataInString("profileId");
+        String profileId = ireq.getExtDataInString(IRequest.PROFILE_ID);
         IProfile profile = ps.getProfile(profileId);
         CertReviewResponse data = CertReviewResponseFactory.create(
                 cmsReq, profile, authority.noncesEnabled(), locale);
@@ -134,7 +134,7 @@ public class RequestProcessor extends CertProcessor {
             // save auth token in request
             saveAuthToken(authToken, req);
 
-            String profileId = req.getExtDataInString("profileId");
+            String profileId = req.getExtDataInString(IRequest.PROFILE_ID);
             if (profileId == null || profileId.equals("")) {
                 CMS.debug("RequestProcessor: Profile Id not found in request");
                 throw new EBaseException(CMS.getUserMessage(locale, "CMS_PROFILE_ID_NOT_FOUND"));
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java b/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
index 744f9347265fb89491e2673151ab9aac9ab8a271..fa36dea2657238949cd1b716d43676eb5244fb31 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
@@ -1622,7 +1622,7 @@ public class CRSEnrollment extends HttpServlet {
             // set transaction id
             reqs[0].setSourceId(req.getTransactionID());
             reqs[0].setExtData("profile", "true");
-            reqs[0].setExtData("profileId", mProfileId);
+            reqs[0].setExtData(IRequest.PROFILE_ID, mProfileId);
             reqs[0].setExtData(IEnrollProfile.CTX_CERT_REQUEST_TYPE, IEnrollProfile.REQ_TYPE_PKCS10);
             reqs[0].setExtData(IEnrollProfile.CTX_CERT_REQUEST, pkcs10blob);
             reqs[0].setExtData("requestor_name", "");
@@ -1734,7 +1734,7 @@ public class CRSEnrollment extends HttpServlet {
 
         RequestStatus status = pkiReq.getRequestStatus();
 
-        String profileId = pkiReq.getExtDataInString("profileId");
+        String profileId = pkiReq.getExtDataInString(IRequest.PROFILE_ID);
         if (profileId != null) {
             CMS.debug("CRSEnrollment: Found profile request");
             X509CertImpl cert =
diff --git a/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java b/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java
index 582223ecb2c49344d3b03bfb9b7d61f4d12233a9..e6dfbc43ee29a4365ba5c197fb8e6ce575294136 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java
@@ -307,7 +307,7 @@ public class ConnectorServlet extends CMSServlet {
     }
 
     public static boolean isProfileRequest(IRequest request) {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals(""))
             return false;
@@ -369,7 +369,7 @@ public class ConnectorServlet extends CMSServlet {
                     e.toString());
         }
 
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
         IProfileSubsystem ps = (IProfileSubsystem)
                 CMS.getSubsystem("profile");
         IEnrollProfile profile = null;
diff --git a/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
index ae91f649541db5ce77679844ad7a4fec680e99e9..62b9a7c4b0437c011700d8d35b917e9a48e06af9 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/processors/CAProcessor.java
@@ -76,7 +76,6 @@ public class CAProcessor extends Processor {
     public final static String HDR_LANG = "accept-language";
     public final static String ARG_PROFILE = "profile";
     public final static String ARG_REQUEST_NOTES = "requestNotes";
-    public final static String ARG_PROFILE_ID = "profileId";
     public final static String ARG_RENEWAL_PROFILE_ID = "rprofileId";
     public final static String ARG_PROFILE_IS_ENABLED = "profileIsEnable";
     public final static String ARG_PROFILE_IS_VISIBLE = "profileIsVisible";
diff --git a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java
index 33de8ff909992d859d54b92d917bd4fd55408a09..00fcbb30cd022fc30f8057fcc976746a5e45ec70 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java
@@ -94,7 +94,7 @@ public class ProfileProcessServlet extends ProfileServlet {
             return;
         }
 
-        String profileId = req.getExtDataInString("profileId");
+        String profileId = req.getExtDataInString(IRequest.PROFILE_ID);
         if (profileId == null || profileId.equals("")) {
             CMS.debug("ProfileProcessServlet: Profile Id not found");
             setError(args, CMS.getUserMessage(locale, "CMS_PROFILE_ID_NOT_FOUND",CMSTemplate.escapeJavaScriptStringHTML(profileId)), request, response);
diff --git a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java
index dc6560d066be6fb677ff47344d6aee79295da48a..fe3c139169c5801f84a8f4d4221ea32012918db3 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/profile/ProfileReviewServlet.java
@@ -206,7 +206,7 @@ public class ProfileReviewServlet extends ProfileServlet {
             return;
         }
 
-        String profileId = req.getExtDataInString("profileId");
+        String profileId = req.getExtDataInString(IRequest.PROFILE_ID);
 
         CMS.debug("ProfileReviewServlet: requestId=" +
                 requestId + " profileId=" + profileId);
diff --git a/base/server/cms/src/com/netscape/cms/servlet/request/CheckRequest.java b/base/server/cms/src/com/netscape/cms/servlet/request/CheckRequest.java
index cba79c338a027abf114ad1bd3fdf19e8ec5a9e4b..76700fe5f50d73063a404fa60f6b0d8f3f0f8d6e 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/request/CheckRequest.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/request/CheckRequest.java
@@ -335,7 +335,7 @@ public class CheckRequest extends CMSServlet {
                     argSet.addRepeatRecord(rarg);
                 }
         */
-        String profileId = r.getExtDataInString("profileId");
+        String profileId = r.getExtDataInString(IRequest.PROFILE_ID);
         if (profileId != null) {
             result = IRequest.RES_SUCCESS;
         }
diff --git a/base/server/cmscore/src/com/netscape/cmscore/connector/RequestTransfer.java b/base/server/cmscore/src/com/netscape/cmscore/connector/RequestTransfer.java
index 6000aeb3e8449414679537b4fc487b43ad28940e..9f77920137fef6a3c14a9432b7362ba51ca3f7d4 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/connector/RequestTransfer.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/connector/RequestTransfer.java
@@ -55,7 +55,7 @@ public class RequestTransfer {
     };
 
     public static boolean isProfileRequest(IRequest request) {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals(""))
             return false;
diff --git a/base/server/cmscore/src/com/netscape/cmscore/ldap/LdapRequestListener.java b/base/server/cmscore/src/com/netscape/cmscore/ldap/LdapRequestListener.java
index 3d4f75466dcb57d6a877401ff02724647874a07b..812381c22cc8ab95499722b72e2b83ef344b7c8c 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/ldap/LdapRequestListener.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/ldap/LdapRequestListener.java
@@ -181,7 +181,7 @@ class LdapEnrollmentListener implements IRequestListener {
                 "LdapRequestListener handling publishing for enrollment request id " +
                         r.getRequestId());
 
-        String profileId = r.getExtDataInString("profileId");
+        String profileId = r.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null) {
             // in case it's not meant for us
diff --git a/base/server/cmscore/src/org/dogtagpki/legacy/core/policy/GenericPolicyProcessor.java b/base/server/cmscore/src/org/dogtagpki/legacy/core/policy/GenericPolicyProcessor.java
index 44506e6ff5be5b869805c771da394d56f150a929..38cb9cdf53dfed4acffa7296a9af4870070e56db 100644
--- a/base/server/cmscore/src/org/dogtagpki/legacy/core/policy/GenericPolicyProcessor.java
+++ b/base/server/cmscore/src/org/dogtagpki/legacy/core/policy/GenericPolicyProcessor.java
@@ -360,7 +360,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor {
     }
 
     public boolean isProfileRequest(IRequest request) {
-        String profileId = request.getExtDataInString("profileId");
+        String profileId = request.getExtDataInString(IRequest.PROFILE_ID);
 
         if (profileId == null || profileId.equals(""))
             return false;
-- 
2.7.4

From e417e593facf6ebe819627599df4bd3351a8ced1 Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftweedal redhat com>
Date: Wed, 7 Dec 2016 14:22:30 +1000
Subject: [PATCH 146/146] Define "req_authority_id" IRequest extdata key in
 IRequest

Part of: https://fedorahosted.org/pki/ticket/1359
---
 base/common/src/com/netscape/certsrv/request/IRequest.java           | 5 +++++
 .../cms/src/com/netscape/cms/profile/common/CAEnrollProfile.java     | 2 +-
 .../cms/src/com/netscape/cms/profile/common/EnrollProfile.java       | 2 +-
 .../netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java   | 3 +--
 .../cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java      | 2 +-
 .../cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java      | 2 +-
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/request/IRequest.java b/base/common/src/com/netscape/certsrv/request/IRequest.java
index b83d5309e0b2aaf271cf4fba3c1ee7d13b347a58..29b1bbb879220a485388cb38af8a8c5508578752 100644
--- a/base/common/src/com/netscape/certsrv/request/IRequest.java
+++ b/base/common/src/com/netscape/certsrv/request/IRequest.java
@@ -91,6 +91,11 @@ public interface IRequest extends Serializable {
 
     public static final String PROFILE_ID = "profileId";
 
+    /**
+     * ID of requested certificate authority (absense implies host authority)
+     */
+    public static final String AUTHORITY_ID = "req_authority_id";
+
     public static final String RESULT = "Result"; // service result.
     public static final Integer RES_SUCCESS = Integer.valueOf(1); // result value
     public static final Integer RES_ERROR = Integer.valueOf(2); // result value
diff --git a/base/server/cms/src/com/netscape/cms/profile/common/CAEnrollProfile.java b/base/server/cms/src/com/netscape/cms/profile/common/CAEnrollProfile.java
index 53edca3a93c28a4fdd6c476bbdd2dc3d83869505..8c14e91767f6cc765413821da71b2c26d86f77d3 100644
--- a/base/server/cms/src/com/netscape/cms/profile/common/CAEnrollProfile.java
+++ b/base/server/cms/src/com/netscape/cms/profile/common/CAEnrollProfile.java
@@ -192,7 +192,7 @@ public class CAEnrollProfile extends EnrollProfile {
             sc.put("profileSetId", setId);
         }
         AuthorityID aid = null;
-        String aidString = request.getExtDataInString(REQUEST_AUTHORITY_ID);
+        String aidString = request.getExtDataInString(IRequest.AUTHORITY_ID);
         if (aidString != null)
             aid = new AuthorityID(aidString);
         try {
diff --git a/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java b/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
index e828b82f203edfc6e6fb8797c5909c7cdd6a32d9..fbb98262929f1c5e12ab54a7514c15297364e971 100644
--- a/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
+++ b/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java
@@ -192,7 +192,7 @@ public abstract class EnrollProfile extends BasicProfile
             }
 
             // set requested CA
-            result[i].setExtData(REQUEST_AUTHORITY_ID, ctx.get(REQUEST_AUTHORITY_ID));
+            result[i].setExtData(IRequest.AUTHORITY_ID, ctx.get(REQUEST_AUTHORITY_ID));
         }
         return result;
     }
diff --git a/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java
index 9aaa29d7a417739c62c9c46968933253dbcddd89..42931de2644e602089fc40d331f73964ad35390f 100644
--- a/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java
+++ b/base/server/cms/src/com/netscape/cms/profile/def/AuthorityKeyIdentifierExtDefault.java
@@ -26,7 +26,6 @@ import com.netscape.certsrv.base.IConfigStore;
 import com.netscape.certsrv.ca.AuthorityID;
 import com.netscape.certsrv.ca.ICertificateAuthority;
 import com.netscape.certsrv.profile.EProfileException;
-import com.netscape.certsrv.profile.IEnrollProfile;
 import com.netscape.certsrv.profile.IProfile;
 import com.netscape.certsrv.property.Descriptor;
 import com.netscape.certsrv.property.EPropertyException;
@@ -172,7 +171,7 @@ public class AuthorityKeyIdentifierExtDefault extends CAEnrollDefault {
         ICertificateAuthority ca = (ICertificateAuthority)
                 CMS.getSubsystem(CMS.SUBSYSTEM_CA);
         String aidString = request.getExtDataInString(
-                IEnrollProfile.REQUEST_AUTHORITY_ID);
+                IRequest.AUTHORITY_ID);
         if (aidString != null)
             ca = ca.getCA(new AuthorityID(aidString));
         if (ca == null)
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
index 01ffc8be43a90c428fa61e97a70cfe3d87b8710f..1c9f0d6acad00025884a33a22461c7d61b4a5676 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/RenewalProcessor.java
@@ -217,7 +217,7 @@ public class RenewalProcessor extends CertProcessor {
             CMS.debug("RenewalSubmitter: renewal original profileId=" + profileId);
 
             String aidString = origReq.getExtDataInString(
-                    IEnrollProfile.REQUEST_AUTHORITY_ID);
+                    IRequest.AUTHORITY_ID);
 
             Integer origSeqNum = origReq.getExtDataInInteger(IEnrollProfile.REQUEST_SEQ_NUM);
             IProfile profile = ps.getProfile(profileId);
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
index 7f0c89ce5fad8c334dd204188c3e9ce103c207bd..436e7a99a78e7bf4a46f626f628652f5d3d1301c 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/RequestProcessor.java
@@ -378,7 +378,7 @@ public class RequestProcessor extends CertProcessor {
         String auditRequesterID = auditRequesterID(req);
 
         // ensure target CA is enabled
-        String aidString = req.getExtDataInString(IEnrollProfile.REQUEST_AUTHORITY_ID);
+        String aidString = req.getExtDataInString(IRequest.AUTHORITY_ID);
         if (aidString != null)
             ensureCAEnabled(aidString);
 
-- 
2.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]