diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2016-11-04 19:18:15 +0100 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2016-11-11 23:22:25 +0100 |
| commit | 54c04a1d7c270f4e162695105468d280bdc7d028 (patch) | |
| tree | ca9df178079b03bb31ab9fb16a011364e69025a5 /base/ca/src/com/netscape | |
| parent | fdb4b69e839db08f686e744c0dfeff8890068491 (diff) | |
| download | pki-54c04a1d7c270f4e162695105468d280bdc7d028.tar.gz pki-54c04a1d7c270f4e162695105468d280bdc7d028.tar.xz pki-54c04a1d7c270f4e162695105468d280bdc7d028.zip | |
Moved policy framework classes to org.dogtagpki.legacy.
To discourage the use of policy framework, the framework classes
have been moved into org.dogtagpki.legacy.
https://fedorahosted.org/pki/ticket/6
Diffstat (limited to 'base/ca/src/com/netscape')
| -rw-r--r-- | base/ca/src/com/netscape/ca/CAPolicy.java | 137 | ||||
| -rw-r--r-- | base/ca/src/com/netscape/ca/CertificateAuthority.java | 3 |
2 files changed, 2 insertions, 138 deletions
diff --git a/base/ca/src/com/netscape/ca/CAPolicy.java b/base/ca/src/com/netscape/ca/CAPolicy.java deleted file mode 100644 index dda7e52d5..000000000 --- a/base/ca/src/com/netscape/ca/CAPolicy.java +++ /dev/null @@ -1,137 +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) 2007 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.ca; - -import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.base.IConfigStore; -import com.netscape.certsrv.base.ISubsystem; -import com.netscape.certsrv.ca.ICertificateAuthority; -import com.netscape.certsrv.policy.IPolicyProcessor; -import com.netscape.certsrv.profile.IProfile; -import com.netscape.certsrv.profile.IProfileSubsystem; -import com.netscape.certsrv.request.IPolicy; -import com.netscape.certsrv.request.IRequest; -import com.netscape.certsrv.request.PolicyResult; -import com.netscape.cmscore.policy.GenericPolicyProcessor; -import com.netscape.cmscore.util.Debug; - -/** - * XXX Just inherit 'GenericPolicyProcessor' (from RA) for now. - * This really bad. need to make a special case just for connector. - * would like a much better way of doing this to handle both EE and - * connectors. - * XXX2 moved to just implement IPolicy since GenericPolicyProcessor is - * unuseable for CA. - * - * @version $Revision$, $Date$ - */ -public class CAPolicy implements IPolicy { - IConfigStore mConfig = null; - ICertificateAuthority mCA = null; - - public static String PROP_PROCESSOR = - "processor"; - // These are the different types of policy that are - // allowed for the "processor" property - public static String PR_TYPE_CLASSIC = "classic"; - - // XXX this way for now since generic just works for EE. - public GenericPolicyProcessor mPolicies = null; - - public CAPolicy() { - } - - public IPolicyProcessor getPolicyProcessor() { - return mPolicies; - } - - public void init(ISubsystem owner, IConfigStore config) - throws EBaseException { - mCA = (ICertificateAuthority) owner; - mConfig = config; - - String processorType = // XXX - need to upgrade 4.2 - config.getString(PROP_PROCESSOR, PR_TYPE_CLASSIC); - - Debug.trace("selected policy processor = " + processorType); - if (processorType.equals(PR_TYPE_CLASSIC)) { - mPolicies = new GenericPolicyProcessor(); - } else { - throw new EBaseException("Unknown policy processor type (" + - processorType + ")"); - } - - mPolicies.init(mCA, mConfig); - } - - public boolean isProfileRequest(IRequest request) { - String profileId = request.getExtDataInString("profileId"); - - if (profileId == null || profileId.equals("")) - return false; - else - return true; - } - - /** - */ - public PolicyResult apply(IRequest r) { - if (r == null) { - Debug.trace("in CAPolicy.apply(request=null)"); - return PolicyResult.REJECTED; - } - - Debug.trace("in CAPolicy.apply(requestType=" + - r.getRequestType() + ",requestId=" + - r.getRequestId().toString() + ",requestStatus=" + - r.getRequestStatus().toString() + ")"); - - if (isProfileRequest(r)) { - Debug.trace("CAPolicy: Profile-base Request " + - r.getRequestId().toString()); - - CMS.debug("CAPolicy: requestId=" + - r.getRequestId().toString()); - - String profileId = r.getExtDataInString("profileId"); - - if (profileId == null || profileId.equals("")) { - return PolicyResult.REJECTED; - } - - IProfileSubsystem ps = (IProfileSubsystem) - CMS.getSubsystem("profile"); - - try { - IProfile profile = ps.getProfile(profileId); - - r.setExtData("dbStatus", "NOT_UPDATED"); - profile.populate(r); - profile.validate(r); - return PolicyResult.ACCEPTED; - } catch (EBaseException e) { - CMS.debug("CAPolicy: " + e.toString()); - return PolicyResult.REJECTED; - } - } - Debug.trace("mPolicies = " + mPolicies.getClass()); - return mPolicies.apply(r); - } - -} diff --git a/base/ca/src/com/netscape/ca/CertificateAuthority.java b/base/ca/src/com/netscape/ca/CertificateAuthority.java index 6a1f9b679..92bf64412 100644 --- a/base/ca/src/com/netscape/ca/CertificateAuthority.java +++ b/base/ca/src/com/netscape/ca/CertificateAuthority.java @@ -52,6 +52,8 @@ import java.util.concurrent.CountDownLatch; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.dogtagpki.legacy.ca.CAPolicy; +import org.dogtagpki.legacy.policy.IPolicyProcessor; import org.mozilla.jss.CryptoManager; import org.mozilla.jss.asn1.ASN1Util; import org.mozilla.jss.asn1.GeneralizedTime; @@ -104,7 +106,6 @@ import com.netscape.certsrv.ldap.ELdapException; import com.netscape.certsrv.ldap.ILdapConnFactory; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.ocsp.IOCSPService; -import com.netscape.certsrv.policy.IPolicyProcessor; import com.netscape.certsrv.profile.IEnrollProfile; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileSubsystem; |
