diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-11 09:47:39 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-15 12:07:43 -0500 |
commit | 1aa02e5207514d210e903d23e1d698b85fc29344 (patch) | |
tree | 3bd555aed82c2446208444939594aac3e3979308 /base/common/src/com/netscape/cms | |
parent | 3c9b8e787ccf066c38469e1fe2c119d5c410bb5e (diff) | |
download | pki-1aa02e5207514d210e903d23e1d698b85fc29344.tar.gz pki-1aa02e5207514d210e903d23e1d698b85fc29344.tar.xz pki-1aa02e5207514d210e903d23e1d698b85fc29344.zip |
Reorganized REST common classes.
The common classes used by REST client and services have been moved
into the com.netscape.certsrv.<component> packages.
Ticket #215
Diffstat (limited to 'base/common/src/com/netscape/cms')
99 files changed, 179 insertions, 6995 deletions
diff --git a/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java b/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java index 2c1936a6f..445778db4 100644 --- a/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java +++ b/base/common/src/com/netscape/cms/client/PKIErrorInterceptor.java @@ -23,7 +23,7 @@ import javax.ws.rs.core.MultivaluedMap; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.client.core.ClientErrorInterceptor; -import com.netscape.cms.servlet.base.PKIException; +import com.netscape.certsrv.base.PKIException; public class PKIErrorInterceptor implements ClientErrorInterceptor { diff --git a/base/common/src/com/netscape/cms/client/ca/CAClient.java b/base/common/src/com/netscape/cms/client/ca/CAClient.java index 17d017cce..a72f95962 100644 --- a/base/common/src/com/netscape/cms/client/ca/CAClient.java +++ b/base/common/src/com/netscape/cms/client/ca/CAClient.java @@ -20,22 +20,22 @@ package com.netscape.cms.client.ca; import java.net.URISyntaxException; import java.util.Collection; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertDataInfos; +import com.netscape.certsrv.cert.CertEnrollmentRequest; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestInfos; +import com.netscape.certsrv.cert.CertRequestResource; +import com.netscape.certsrv.cert.CertResource; +import com.netscape.certsrv.cert.CertReviewResponse; +import com.netscape.certsrv.cert.CertSearchRequest; import com.netscape.certsrv.dbs.certdb.CertId; +import com.netscape.certsrv.profile.ProfileData; +import com.netscape.certsrv.profile.ProfileDataInfos; +import com.netscape.certsrv.profile.ProfileResource; import com.netscape.certsrv.request.RequestId; import com.netscape.cms.client.ClientConfig; import com.netscape.cms.client.PKIClient; -import com.netscape.cms.servlet.cert.CertResource; -import com.netscape.cms.servlet.cert.model.CertDataInfos; -import com.netscape.cms.servlet.cert.model.CertSearchRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.profile.ProfileResource; -import com.netscape.cms.servlet.profile.model.ProfileData; -import com.netscape.cms.servlet.profile.model.ProfileDataInfos; -import com.netscape.cms.servlet.request.CertRequestResource; -import com.netscape.cms.servlet.request.model.CertReviewResponse; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class CAClient extends PKIClient { diff --git a/base/common/src/com/netscape/cms/client/cert/CertCLI.java b/base/common/src/com/netscape/cms/client/cert/CertCLI.java index ced2560ec..f7bb27597 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertCLI.java @@ -23,11 +23,11 @@ import java.util.Arrays; import org.apache.commons.lang.StringUtils; import org.jboss.resteasy.plugins.providers.atom.Link; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertDataInfo; +import com.netscape.certsrv.cert.CertRequestInfo; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.cert.model.CertDataInfo; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.model.CertRequestInfo; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/cert/CertClient.java b/base/common/src/com/netscape/cms/client/cert/CertClient.java index 254e8a143..1fcb9e40d 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertClient.java +++ b/base/common/src/com/netscape/cms/client/cert/CertClient.java @@ -19,21 +19,21 @@ package com.netscape.cms.client.cert; import java.net.URISyntaxException; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertDataInfos; +import com.netscape.certsrv.cert.CertEnrollmentRequest; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestInfos; +import com.netscape.certsrv.cert.CertRequestResource; +import com.netscape.certsrv.cert.CertResource; +import com.netscape.certsrv.cert.CertReviewResponse; +import com.netscape.certsrv.cert.CertRevokeRequest; +import com.netscape.certsrv.cert.CertSearchRequest; +import com.netscape.certsrv.cert.CertUnrevokeRequest; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.request.RequestId; import com.netscape.cms.client.ClientConfig; import com.netscape.cms.client.PKIClient; -import com.netscape.cms.servlet.cert.CertResource; -import com.netscape.cms.servlet.cert.model.CertDataInfos; -import com.netscape.cms.servlet.cert.model.CertRevokeRequest; -import com.netscape.cms.servlet.cert.model.CertSearchRequest; -import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.CertRequestResource; -import com.netscape.cms.servlet.request.model.CertReviewResponse; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; /** * @author Endi S. Dewata @@ -70,11 +70,11 @@ public class CertClient extends PKIClient { return certClient.unrevokeCert(id, request); } - public CertRequestInfos enrollRequest(CertEnrollmentRequest data){ + public CertRequestInfos enrollRequest(CertEnrollmentRequest data) { return certRequestResource.enrollCert(data); } - public CertReviewResponse reviewRequest(RequestId id){ + public CertReviewResponse reviewRequest(RequestId id) { return certRequestResource.reviewRequest(id); } diff --git a/base/common/src/com/netscape/cms/client/cert/CertFindCLI.java b/base/common/src/com/netscape/cms/client/cert/CertFindCLI.java index e67276ac3..f69506224 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertFindCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertFindCLI.java @@ -28,12 +28,12 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.cert.CertDataInfo; +import com.netscape.certsrv.cert.CertDataInfos; +import com.netscape.certsrv.cert.CertSearchRequest; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.base.PKIException; -import com.netscape.cms.servlet.cert.model.CertDataInfo; -import com.netscape.cms.servlet.cert.model.CertDataInfos; -import com.netscape.cms.servlet.cert.model.CertSearchRequest; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/cert/CertHoldCLI.java b/base/common/src/com/netscape/cms/client/cert/CertHoldCLI.java index 1e283b722..33667f3f0 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertHoldCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertHoldCLI.java @@ -26,13 +26,13 @@ import netscape.security.x509.RevocationReason; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRevokeRequest; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.cert.model.CertRevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.model.CertRequestInfo; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/cert/CertReleaseHoldCLI.java b/base/common/src/com/netscape/cms/client/cert/CertReleaseHoldCLI.java index 920c642e5..10408273f 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertReleaseHoldCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertReleaseHoldCLI.java @@ -23,13 +23,13 @@ import java.io.InputStreamReader; import org.apache.commons.cli.CommandLine; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertUnrevokeRequest; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.model.CertRequestInfo; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/cert/CertRequestApproveCLI.java b/base/common/src/com/netscape/cms/client/cert/CertRequestApproveCLI.java index 91cb26e14..c96f482c8 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertRequestApproveCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertRequestApproveCLI.java @@ -10,10 +10,10 @@ import javax.xml.bind.Unmarshaller; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.base.PKIException; -import com.netscape.cms.servlet.request.model.CertReviewResponse; public class CertRequestApproveCLI extends CLI { CertCLI parent; diff --git a/base/common/src/com/netscape/cms/client/cert/CertRequestReviewCLI.java b/base/common/src/com/netscape/cms/client/cert/CertRequestReviewCLI.java index 61c8506e7..22b1faed3 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertRequestReviewCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertRequestReviewCLI.java @@ -11,11 +11,11 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.ParseException; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.request.RequestId; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.base.PKIException; -import com.netscape.cms.servlet.request.model.CertReviewResponse; public class CertRequestReviewCLI extends CLI { diff --git a/base/common/src/com/netscape/cms/client/cert/CertRequestSubmitCLI.java b/base/common/src/com/netscape/cms/client/cert/CertRequestSubmitCLI.java index 021400f75..cd974b031 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertRequestSubmitCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertRequestSubmitCLI.java @@ -11,11 +11,11 @@ import javax.xml.bind.Unmarshaller; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; +import com.netscape.certsrv.cert.CertEnrollmentRequest; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestInfos; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class CertRequestSubmitCLI extends CLI { diff --git a/base/common/src/com/netscape/cms/client/cert/CertRevokeCLI.java b/base/common/src/com/netscape/cms/client/cert/CertRevokeCLI.java index 611e50c37..de5dddc09 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertRevokeCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertRevokeCLI.java @@ -26,13 +26,13 @@ import netscape.security.x509.RevocationReason; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRevokeRequest; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.cert.model.CertRevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.model.CertRequestInfo; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/cert/CertShowCLI.java b/base/common/src/com/netscape/cms/client/cert/CertShowCLI.java index a16e36f3f..4fcfc8c3d 100644 --- a/base/common/src/com/netscape/cms/client/cert/CertShowCLI.java +++ b/base/common/src/com/netscape/cms/client/cert/CertShowCLI.java @@ -24,10 +24,10 @@ import java.io.PrintWriter; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; +import com.netscape.certsrv.cert.CertData; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.cms.client.cli.CLI; import com.netscape.cms.client.cli.MainCLI; -import com.netscape.cms.servlet.cert.model.CertData; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/client/kra/DRMClient.java b/base/common/src/com/netscape/cms/client/kra/DRMClient.java index 2332eacb2..4bcf52987 100644 --- a/base/common/src/com/netscape/cms/client/kra/DRMClient.java +++ b/base/common/src/com/netscape/cms/client/kra/DRMClient.java @@ -6,21 +6,21 @@ import java.util.Iterator; import org.jboss.resteasy.client.ClientResponse; +import com.netscape.certsrv.cert.CertData; import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.key.KeyArchivalRequest; +import com.netscape.certsrv.key.KeyData; +import com.netscape.certsrv.key.KeyDataInfo; +import com.netscape.certsrv.key.KeyDataInfos; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyRequestInfos; +import com.netscape.certsrv.key.KeyRequestResource; +import com.netscape.certsrv.key.KeyResource; import com.netscape.certsrv.request.RequestId; +import com.netscape.certsrv.system.SystemCertificateResource; import com.netscape.cms.client.ClientConfig; import com.netscape.cms.client.PKIClient; -import com.netscape.cms.servlet.admin.SystemCertificateResource; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.key.KeyResource; -import com.netscape.cms.servlet.key.model.KeyData; -import com.netscape.cms.servlet.key.model.KeyDataInfo; -import com.netscape.cms.servlet.key.model.KeyDataInfos; -import com.netscape.cms.servlet.request.KeyRequestResource; -import com.netscape.cms.servlet.request.model.KeyArchivalRequest; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRequestInfos; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; import com.netscape.cmsutil.util.Utils; public class DRMClient extends PKIClient { diff --git a/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java b/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java index c01558ed3..c9ee28718 100644 --- a/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java +++ b/base/common/src/com/netscape/cms/client/system/SystemConfigClient.java @@ -19,13 +19,13 @@ package com.netscape.cms.client.system; import java.net.URISyntaxException; +import com.netscape.certsrv.system.ConfigurationRequest; +import com.netscape.certsrv.system.ConfigurationResponse; +import com.netscape.certsrv.system.InstallToken; +import com.netscape.certsrv.system.InstallTokenRequest; +import com.netscape.certsrv.system.SystemConfigResource; import com.netscape.cms.client.ClientConfig; import com.netscape.cms.client.PKIClient; -import com.netscape.cms.servlet.csadmin.SystemConfigResource; -import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest; -import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse; -import com.netscape.cms.servlet.csadmin.model.InstallToken; -import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest; /** diff --git a/base/common/src/com/netscape/cms/servlet/admin/GroupMemberService.java b/base/common/src/com/netscape/cms/servlet/admin/GroupMemberService.java index 7b4ccf323..0854be3aa 100644 --- a/base/common/src/com/netscape/cms/servlet/admin/GroupMemberService.java +++ b/base/common/src/com/netscape/cms/servlet/admin/GroupMemberService.java @@ -31,6 +31,7 @@ import org.jboss.resteasy.plugins.providers.atom.Link; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.base.SessionContext; import com.netscape.certsrv.common.OpDef; import com.netscape.certsrv.common.ScopeDef; @@ -43,7 +44,6 @@ import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.user.UserResource; import com.netscape.certsrv.usrgrp.IGroup; import com.netscape.certsrv.usrgrp.IUGSubsystem; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; /** diff --git a/base/common/src/com/netscape/cms/servlet/admin/GroupService.java b/base/common/src/com/netscape/cms/servlet/admin/GroupService.java index 9f2e32cd1..b82df9a2f 100644 --- a/base/common/src/com/netscape/cms/servlet/admin/GroupService.java +++ b/base/common/src/com/netscape/cms/servlet/admin/GroupService.java @@ -31,6 +31,7 @@ import org.jboss.resteasy.plugins.providers.atom.Link; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.common.OpDef; import com.netscape.certsrv.common.ScopeDef; import com.netscape.certsrv.group.GroupCollection; @@ -40,7 +41,6 @@ import com.netscape.certsrv.logging.IAuditor; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.usrgrp.IGroup; import com.netscape.certsrv.usrgrp.IUGSubsystem; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; import com.netscape.cmsutil.ldap.LDAPUtil; diff --git a/base/common/src/com/netscape/cms/servlet/admin/SystemCertService.java b/base/common/src/com/netscape/cms/servlet/admin/SystemCertService.java index fe6016056..bd84f1141 100644 --- a/base/common/src/com/netscape/cms/servlet/admin/SystemCertService.java +++ b/base/common/src/com/netscape/cms/servlet/admin/SystemCertService.java @@ -24,10 +24,11 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.cert.CertData; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.security.ITransportKeyUnit; +import com.netscape.certsrv.system.SystemCertificateResource; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.cert.model.CertData; /** * This is the class used to list, retrieve and modify system certificates for all Java subsystems. diff --git a/base/common/src/com/netscape/cms/servlet/admin/SystemCertificateResource.java b/base/common/src/com/netscape/cms/servlet/admin/SystemCertificateResource.java deleted file mode 100644 index 16b3b5b5d..000000000 --- a/base/common/src/com/netscape/cms/servlet/admin/SystemCertificateResource.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.netscape.cms.servlet.admin; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.annotations.ClientResponseType; - -import com.netscape.cms.servlet.cert.model.CertData; - -@Path("config/cert") -public interface SystemCertificateResource { - - /** - * Used to retrieve the transport certificate - */ - @GET - @Path("transport") - @ClientResponseType(entityType=CertData.class) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response getTransportCert(); - -}
\ No newline at end of file diff --git a/base/common/src/com/netscape/cms/servlet/admin/UserCertService.java b/base/common/src/com/netscape/cms/servlet/admin/UserCertService.java index c2d4d6cfa..16a584ff8 100644 --- a/base/common/src/com/netscape/cms/servlet/admin/UserCertService.java +++ b/base/common/src/com/netscape/cms/servlet/admin/UserCertService.java @@ -40,6 +40,7 @@ import org.mozilla.jss.crypto.InternalCertificate; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.ICertPrettyPrint; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.common.OpDef; import com.netscape.certsrv.common.ScopeDef; import com.netscape.certsrv.dbs.certdb.CertId; @@ -50,7 +51,6 @@ import com.netscape.certsrv.user.UserCertData; import com.netscape.certsrv.user.UserCertResource; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; import com.netscape.cmsutil.util.Cert; import com.netscape.cmsutil.util.Utils; diff --git a/base/common/src/com/netscape/cms/servlet/admin/UserService.java b/base/common/src/com/netscape/cms/servlet/admin/UserService.java index 687619722..f28a8151f 100644 --- a/base/common/src/com/netscape/cms/servlet/admin/UserService.java +++ b/base/common/src/com/netscape/cms/servlet/admin/UserService.java @@ -33,6 +33,7 @@ import org.jboss.resteasy.plugins.providers.atom.Link; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.common.OpDef; import com.netscape.certsrv.common.ScopeDef; import com.netscape.certsrv.logging.IAuditor; @@ -45,7 +46,6 @@ import com.netscape.certsrv.usrgrp.EUsrGrpException; import com.netscape.certsrv.usrgrp.IGroup; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; import com.netscape.cmsutil.ldap.LDAPUtil; diff --git a/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java b/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java deleted file mode 100644 index cefa26985..000000000 --- a/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java +++ /dev/null @@ -1,38 +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.cms.servlet.base; -import javax.ws.rs.core.Response; - -public class BadRequestException extends PKIException { - - private static final long serialVersionUID = -4784839378360933483L; - - public BadRequestException(String message) { - super(Response.Status.BAD_REQUEST, message); - } - - public BadRequestException(String message, Throwable cause) { - super(Response.Status.BAD_REQUEST, message, cause); - } - - public BadRequestException(Data data) { - super(data); - } - -} - diff --git a/base/common/src/com/netscape/cms/servlet/base/PKIException.java b/base/common/src/com/netscape/cms/servlet/base/PKIException.java deleted file mode 100644 index be2629e17..000000000 --- a/base/common/src/com/netscape/cms/servlet/base/PKIException.java +++ /dev/null @@ -1,182 +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.cms.servlet.base; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -public class PKIException extends RuntimeException { - - private static final long serialVersionUID = 6000910362260369923L; - - public int code; - - public PKIException(String message) { - super(message); - code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); - } - - public PKIException(int code, String message) { - super(message); - this.code = code; - } - - public PKIException(Response.Status status, String message) { - super(message); - code = status.getStatusCode(); - } - - public PKIException(String message, Throwable cause) { - super(message, cause); - code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); - } - - public PKIException(int code, String message, Throwable cause) { - super(message, cause); - this.code = code; - } - - public PKIException(Response.Status status, String message, Throwable cause) { - super(message, cause); - code = status.getStatusCode(); - } - - public PKIException(Data data) { - super(data.message); - code = data.code; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public Data getData() { - Data data = new Data(); - data.className = getClass().getName(); - data.code = code; - data.message = getMessage(); - return data; - } - - @XmlRootElement(name="PKIException") - public static class Data { - - @XmlElement(name="ClassName") - public String className; - - @XmlElement(name="Code") - public int code; - - @XmlElement(name="Message") - public String message; - - @XmlElement(name="Attributes") - @XmlJavaTypeAdapter(MapAdapter.class) - public Map<String, String> attributes = new LinkedHashMap<String, String>(); - - public String getAttribute(String name) { - return attributes.get(name); - } - - public void setAttribute(String name, String value) { - attributes.put(name, value); - } - } - - public static class MapAdapter extends XmlAdapter<AttributeList, Map<String, String>> { - - public AttributeList marshal(Map<String, String> map) { - AttributeList list = new AttributeList(); - for (Map.Entry<String, String> entry : map.entrySet()) { - Attribute attribute = new Attribute(); - attribute.name = entry.getKey(); - attribute.value = entry.getValue(); - list.attributes.add(attribute); - } - return list; - } - - public Map<String, String> unmarshal(AttributeList list) { - Map<String, String> map = new LinkedHashMap<String, String>(); - for (Attribute attribute : list.attributes) { - map.put(attribute.name, attribute.value); - } - return map; - } - } - - public static class AttributeList { - @XmlElement(name="Attribute") - public List<Attribute> attributes = new ArrayList<Attribute>(); - } - - public static class Attribute { - - @XmlAttribute - public String name; - - @XmlValue - public String value; - } - - @Provider - public static class Mapper implements ExceptionMapper<PKIException> { - - public Response toResponse(PKIException exception) { - // convert PKIException into HTTP response with XML content - return Response - .status(exception.getCode()) - .entity(exception.getData()) - .type(MediaType.APPLICATION_XML) - .build(); - } - } - - public static void main(String args[]) throws Exception { - Data data = new Data(); - data.className = PKIException.class.getName(); - data.code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); - data.message = "An error has occured"; - data.setAttribute("attr1", "value1"); - data.setAttribute("attr2", "value2"); - - JAXBContext context = JAXBContext.newInstance(Data.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(data, System.out); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/base/PKIService.java b/base/common/src/com/netscape/cms/servlet/base/PKIService.java index a77846c68..4034a75a3 100644 --- a/base/common/src/com/netscape/cms/servlet/base/PKIService.java +++ b/base/common/src/com/netscape/cms/servlet/base/PKIService.java @@ -36,9 +36,9 @@ import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.UriInfo; import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.cert.CertData; import com.netscape.certsrv.logging.IAuditor; import com.netscape.certsrv.logging.ILogger; -import com.netscape.cms.servlet.cert.model.CertData; /** * Base class for CMS RESTful resources diff --git a/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java b/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java deleted file mode 100644 index 83803601c..000000000 --- a/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java +++ /dev/null @@ -1,43 +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.cms.servlet.base; - -import javax.ws.rs.core.Response; - -/** - * @author Endi S. Dewata - */ -public class UnauthorizedException extends PKIException { - - private static final long serialVersionUID = -2025082875126996556L; - - public UnauthorizedException(String message) { - super(Response.Status.UNAUTHORIZED, message); - } - - public UnauthorizedException(String message, Throwable cause) { - super(Response.Status.UNAUTHORIZED, message, cause); - } - - public UnauthorizedException(Data data) { - super(data); - } - -} - diff --git a/base/common/src/com/netscape/cms/servlet/base/model/Link.java b/base/common/src/com/netscape/cms/servlet/base/model/Link.java deleted file mode 100644 index 336092abe..000000000 --- a/base/common/src/com/netscape/cms/servlet/base/model/Link.java +++ /dev/null @@ -1,88 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK ---/** -package com.netscape.cms.servlet.base.model; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name = "Link") -public class Link { - protected String relationship; - protected String href; - protected String type; - - public Link() { - // required for jaxb - } - - public Link(String relationship, String href, String type) { - this.relationship = relationship; - this.href = href; - this.type = type; - } - - /** - * @return the relationship - */ - @XmlAttribute(name = "rel") - public String getRelationship() { - return relationship; - } - - /** - * @param relationship the relationship to set - */ - public void setRelationship(String relationship) { - this.relationship = relationship; - } - - /** - * @return the href - */ - @XmlAttribute - public String getHref() { - return href; - } - - /** - * @param href the href to set - */ - public void setHref(String href) { - this.href = href; - } - - /** - * @return the type - */ - @XmlAttribute - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertEnrollmentRequestFactory.java b/base/common/src/com/netscape/cms/servlet/cert/CertEnrollmentRequestFactory.java index 2aab69b37..7a26e8e21 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertEnrollmentRequestFactory.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertEnrollmentRequestFactory.java @@ -21,13 +21,13 @@ import java.util.Enumeration; import java.util.Locale; import com.netscape.certsrv.base.IArgBlock; +import com.netscape.certsrv.cert.CertEnrollmentRequest; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileInput; +import com.netscape.certsrv.profile.ProfileInput; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.profile.ProfileInputFactory; -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class CertEnrollmentRequestFactory { diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertNotFoundException.java b/base/common/src/com/netscape/cms/servlet/cert/CertNotFoundException.java deleted file mode 100644 index bcfc18aaf..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/CertNotFoundException.java +++ /dev/null @@ -1,63 +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.cms.servlet.cert; - -import javax.ws.rs.core.Response; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.cms.servlet.base.PKIException; - -public class CertNotFoundException extends PKIException { - - private static final long serialVersionUID = -4784839378360933483L; - - public CertId certId; - - public CertNotFoundException(CertId certId) { - this(certId, "Certificate ID " + certId.toHexString() + " not found"); - } - - public CertNotFoundException(CertId certId, String message) { - super(Response.Status.NOT_FOUND, message); - this.certId = certId; - } - - public CertNotFoundException(CertId certId, String message, Throwable cause) { - super(Response.Status.NOT_FOUND, message, cause); - this.certId = certId; - } - - public CertNotFoundException(Data data) { - super(data); - certId = new CertId(data.getAttribute("certId")); - } - - public Data getData() { - Data data = super.getData(); - data.setAttribute("certId", certId.toString()); - return data; - } - - public CertId getCertId() { - return certId; - } - - public void setRequestId(CertId certId) { - this.certId = certId; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertProcessor.java b/base/common/src/com/netscape/cms/servlet/cert/CertProcessor.java index 2254a0458..4acc94d07 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertProcessor.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertProcessor.java @@ -30,6 +30,7 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; +import com.netscape.certsrv.cert.CertEnrollmentRequest; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.profile.EDeferException; import com.netscape.certsrv.profile.ERejectException; @@ -37,12 +38,11 @@ import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileAuthenticator; import com.netscape.certsrv.profile.IProfileContext; import com.netscape.certsrv.profile.IProfileInput; +import com.netscape.certsrv.profile.ProfileInput; import com.netscape.certsrv.request.INotify; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.servlet.processors.Processor; -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class CertProcessor extends Processor { diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertRequestDAO.java b/base/common/src/com/netscape/cms/servlet/cert/CertRequestDAO.java index cac3371d0..bcb19a70b 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertRequestDAO.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertRequestDAO.java @@ -32,21 +32,20 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.Nonces; import com.netscape.certsrv.ca.ICertificateAuthority; +import com.netscape.certsrv.cert.CertEnrollmentRequest; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestInfos; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileSubsystem; +import com.netscape.certsrv.request.CMSRequestInfo; +import com.netscape.certsrv.request.CMSRequestInfos; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; +import com.netscape.certsrv.request.RequestNotFoundException; import com.netscape.cms.servlet.processors.Processor; import com.netscape.cms.servlet.request.CMSRequestDAO; -import com.netscape.cms.servlet.request.RequestNotFoundException; -import com.netscape.cms.servlet.request.model.CMSRequestInfo; -import com.netscape.cms.servlet.request.model.CMSRequestInfos; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertReviewResponse; - /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertRequestInfoFactory.java b/base/common/src/com/netscape/cms/servlet/cert/CertRequestInfoFactory.java index 3320d946a..fc16bd5f0 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertRequestInfoFactory.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertRequestInfoFactory.java @@ -28,12 +28,13 @@ import netscape.security.x509.X509CertImpl; import org.apache.commons.lang.StringUtils; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestResource; +import com.netscape.certsrv.cert.CertResource; import com.netscape.certsrv.profile.IEnrollProfile; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; -import com.netscape.cms.servlet.request.CertRequestResource; -import com.netscape.cms.servlet.request.model.CertRequestInfo; public class CertRequestInfoFactory { diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertResource.java b/base/common/src/com/netscape/cms/servlet/cert/CertResource.java deleted file mode 100644 index e937b2816..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/CertResource.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.netscape.cms.servlet.cert; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.cms.servlet.cert.model.CertDataInfos; -import com.netscape.cms.servlet.cert.model.CertRevokeRequest; -import com.netscape.cms.servlet.cert.model.CertSearchRequest; -import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; -import com.netscape.cms.servlet.request.model.CertRequestInfo; - -@Path("") -public interface CertResource { - - public static final int DEFAULT_MAXTIME = 0; - public static final int DEFAULT_MAXRESULTS = 20; - - @GET - @Path("certs") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertDataInfos listCerts( - @QueryParam("status") String status, - @DefaultValue("" + DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, - @DefaultValue("" + DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); - - @POST - @Path("certs/search") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertDataInfos searchCerts( - CertSearchRequest data, - @QueryParam("start") Integer start, - @QueryParam("size") Integer size); - - @GET - @Path("certs/{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertData getCert(@PathParam("id") CertId id); - - @POST - @Path("agent/certs/{id}/revoke-ca") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfo revokeCACert(@PathParam("id") CertId id, CertRevokeRequest request); - - @POST - @Path("agent/certs/{id}/revoke") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfo revokeCert(@PathParam("id") CertId id, CertRevokeRequest request); - - @POST - @Path("agent/certs/{id}/unrevoke") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfo unrevokeCert(@PathParam("id") CertId id, CertUnrevokeRequest request); -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertReviewResponseFactory.java b/base/common/src/com/netscape/cms/servlet/cert/CertReviewResponseFactory.java index 7a7c3e9f0..97611eb94 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertReviewResponseFactory.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertReviewResponseFactory.java @@ -27,11 +27,17 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.base.Nonces; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IPolicyDefault; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileInput; import com.netscape.certsrv.profile.IProfilePolicy; +import com.netscape.certsrv.profile.PolicyConstraint; +import com.netscape.certsrv.profile.PolicyDefault; +import com.netscape.certsrv.profile.ProfileInput; +import com.netscape.certsrv.profile.ProfilePolicy; +import com.netscape.certsrv.profile.ProfilePolicySet; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; import com.netscape.cms.servlet.common.CMSRequest; @@ -39,12 +45,6 @@ import com.netscape.cms.servlet.processors.Processor; import com.netscape.cms.servlet.profile.PolicyConstraintFactory; import com.netscape.cms.servlet.profile.PolicyDefaultFactory; import com.netscape.cms.servlet.profile.ProfileInputFactory; -import com.netscape.cms.servlet.profile.model.PolicyConstraint; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.profile.model.ProfilePolicy; -import com.netscape.cms.servlet.profile.model.ProfilePolicySet; -import com.netscape.cms.servlet.request.model.CertReviewResponse; public class CertReviewResponseFactory { @@ -154,8 +154,8 @@ public class CertReviewResponseFactory { String id = policyIds.nextElement(); CMS.debug("policyId:" + id); IProfilePolicy policy = profile.getProfilePolicy(profileSetId, id); - com.netscape.cms.servlet.profile.model.ProfilePolicy dataPolicy = - new com.netscape.cms.servlet.profile.model.ProfilePolicy(); + com.netscape.certsrv.profile.ProfilePolicy dataPolicy = + new com.netscape.certsrv.profile.ProfilePolicy(); //populate defaults IPolicyDefault def = policy.getDefault(); diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertService.java b/base/common/src/com/netscape/cms/servlet/cert/CertService.java index 0ccccf7bd..e4a6fc994 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/CertService.java +++ b/base/common/src/com/netscape/cms/servlet/cert/CertService.java @@ -43,9 +43,22 @@ import netscape.security.x509.X509CertImpl; import org.jboss.resteasy.plugins.providers.atom.Link; import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.base.BadRequestException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.ICertPrettyPrint; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.base.UnauthorizedException; import com.netscape.certsrv.ca.ICertificateAuthority; +import com.netscape.certsrv.cert.CertData; +import com.netscape.certsrv.cert.CertDataInfo; +import com.netscape.certsrv.cert.CertDataInfos; +import com.netscape.certsrv.cert.CertNotFoundException; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertResource; +import com.netscape.certsrv.cert.CertRetrievalRequest; +import com.netscape.certsrv.cert.CertRevokeRequest; +import com.netscape.certsrv.cert.CertSearchRequest; +import com.netscape.certsrv.cert.CertUnrevokeRequest; import com.netscape.certsrv.dbs.EDBRecordNotFoundException; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.dbs.certdb.ICertRecord; @@ -53,19 +66,8 @@ import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.logging.AuditFormat; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.base.BadRequestException; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.base.UnauthorizedException; -import com.netscape.cms.servlet.cert.model.CertDataInfo; -import com.netscape.cms.servlet.cert.model.CertDataInfos; -import com.netscape.cms.servlet.cert.model.CertRevokeRequest; -import com.netscape.cms.servlet.cert.model.CertSearchRequest; -import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest; -import com.netscape.cms.servlet.cert.model.CertData; import com.netscape.cms.servlet.processors.Processor; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRetrievalRequest; import com.netscape.cmsutil.ldap.LDAPUtil; import com.netscape.cmsutil.util.Utils; diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java b/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java index f74a6bbac..f45947e8c 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java +++ b/base/common/src/com/netscape/cms/servlet/cert/DoRevoke.java @@ -49,6 +49,7 @@ import com.netscape.certsrv.authorization.EAuthzAccessDenied; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.base.Nonces; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.CertId; @@ -65,7 +66,6 @@ import com.netscape.certsrv.usrgrp.Certificates; import com.netscape.certsrv.usrgrp.ICertUserLocator; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.CMSServlet; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.common.CMSTemplate; diff --git a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java index 0f41d3e6a..cca8381fd 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java +++ b/base/common/src/com/netscape/cms/servlet/cert/DoUnrevoke.java @@ -40,6 +40,7 @@ import com.netscape.certsrv.authorization.AuthzToken; import com.netscape.certsrv.authorization.EAuthzAccessDenied; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IArgBlock; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.ca.ICRLIssuingPoint; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.CertId; @@ -50,7 +51,6 @@ import com.netscape.certsrv.publish.IPublisherProcessor; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.CMSServlet; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.common.CMSTemplate; diff --git a/base/common/src/com/netscape/cms/servlet/cert/EnrollmentProcessor.java b/base/common/src/com/netscape/cms/servlet/cert/EnrollmentProcessor.java index cfd3be05f..911b30fa3 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/EnrollmentProcessor.java +++ b/base/common/src/com/netscape/cms/servlet/cert/EnrollmentProcessor.java @@ -30,15 +30,15 @@ import com.netscape.certsrv.base.BadRequestDataException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.SessionContext; +import com.netscape.certsrv.cert.CertEnrollmentRequest; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileAuthenticator; import com.netscape.certsrv.profile.IProfileContext; import com.netscape.certsrv.profile.IProfileInput; +import com.netscape.certsrv.profile.ProfileInput; import com.netscape.certsrv.request.IRequest; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.profile.SSLClientCertProvider; -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class EnrollmentProcessor extends CertProcessor { diff --git a/base/common/src/com/netscape/cms/servlet/cert/RenewalProcessor.java b/base/common/src/com/netscape/cms/servlet/cert/RenewalProcessor.java index 2a9f10648..a13a305b8 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/RenewalProcessor.java +++ b/base/common/src/com/netscape/cms/servlet/cert/RenewalProcessor.java @@ -35,6 +35,7 @@ import com.netscape.certsrv.base.BadRequestDataException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.SessionContext; +import com.netscape.certsrv.cert.CertEnrollmentRequest; import com.netscape.certsrv.dbs.certdb.ICertRecord; import com.netscape.certsrv.profile.IEnrollProfile; import com.netscape.certsrv.profile.IProfile; @@ -44,7 +45,6 @@ import com.netscape.certsrv.profile.IProfileInput; import com.netscape.certsrv.request.IRequest; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.profile.SSLClientCertProvider; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; public class RenewalProcessor extends CertProcessor { diff --git a/base/common/src/com/netscape/cms/servlet/cert/RequestProcessor.java b/base/common/src/com/netscape/cms/servlet/cert/RequestProcessor.java index b1757f130..74a3183d6 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/RequestProcessor.java +++ b/base/common/src/com/netscape/cms/servlet/cert/RequestProcessor.java @@ -36,6 +36,7 @@ import com.netscape.certsrv.base.BadRequestDataException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.profile.EDeferException; import com.netscape.certsrv.profile.EProfileException; @@ -46,6 +47,10 @@ import com.netscape.certsrv.profile.IPolicyDefault; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileOutput; import com.netscape.certsrv.profile.IProfilePolicy; +import com.netscape.certsrv.profile.PolicyDefault; +import com.netscape.certsrv.profile.ProfileAttribute; +import com.netscape.certsrv.profile.ProfileOutput; +import com.netscape.certsrv.profile.ProfilePolicySet; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestId; @@ -53,11 +58,6 @@ import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.profile.common.ProfilePolicy; import com.netscape.cms.servlet.common.CMSRequest; import com.netscape.cms.servlet.profile.ProfileOutputFactory; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfileOutput; -import com.netscape.cms.servlet.profile.model.ProfilePolicySet; -import com.netscape.cms.servlet.request.model.CertReviewResponse; public class RequestProcessor extends CertProcessor { @@ -410,7 +410,7 @@ public class RequestProcessor extends CertProcessor { // put request policy defaults in a local hash HashMap<String, String> policyData = new HashMap<String,String>(); for (ProfilePolicySet policySet: data.getPolicySets()) { - for (com.netscape.cms.servlet.profile.model.ProfilePolicy policy: policySet.getPolicies()) { + for (com.netscape.certsrv.profile.ProfilePolicy policy: policySet.getPolicies()) { PolicyDefault def = policy.getDef(); List<ProfileAttribute> attrs = def.getAttributes(); for (ProfileAttribute attr: attrs) { diff --git a/base/common/src/com/netscape/cms/servlet/cert/RevocationProcessor.java b/base/common/src/com/netscape/cms/servlet/cert/RevocationProcessor.java index 3f0fffbf4..36d00459b 100644 --- a/base/common/src/com/netscape/cms/servlet/cert/RevocationProcessor.java +++ b/base/common/src/com/netscape/cms/servlet/cert/RevocationProcessor.java @@ -35,8 +35,10 @@ import netscape.security.x509.RevokedCertImpl; import netscape.security.x509.X509CertImpl; import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.base.BadRequestException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; +import com.netscape.certsrv.base.UnauthorizedException; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.CertId; import com.netscape.certsrv.dbs.certdb.ICertRecord; @@ -48,8 +50,6 @@ import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; -import com.netscape.cms.servlet.base.BadRequestException; -import com.netscape.cms.servlet.base.UnauthorizedException; /** * @author Endi S. Dewata diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertData.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertData.java deleted file mode 100644 index 50fcf81da..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/CertData.java +++ /dev/null @@ -1,283 +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.cms.servlet.cert.model; - -import java.io.PrintWriter; -import java.io.StringReader; -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import org.jboss.resteasy.plugins.providers.atom.Link; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.certsrv.dbs.certdb.CertIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name = "CertData") -public class CertData { - - public static Marshaller marshaller; - public static Unmarshaller unmarshaller; - - static { - try { - marshaller = JAXBContext.newInstance(CertData.class).createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - unmarshaller = JAXBContext.newInstance(CertData.class).createUnmarshaller(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - CertId serialNumber; - String issuerDN; - String subjectDN; - String prettyPrint; - String encoded; - String pkcs7CertChain; - String notBefore; - String notAfter; - String status; - - Link link; - - @XmlAttribute(name="id") - @XmlJavaTypeAdapter(CertIdAdapter.class) - public CertId getSerialNumber() { - return serialNumber; - } - - public void setSerialNumber(CertId serialNumber) { - this.serialNumber = serialNumber; - } - - @XmlElement(name="IssuerDN") - public String getIssuerDN() { - return issuerDN; - } - - public void setIssuerDN(String issuerDN) { - this.issuerDN = issuerDN; - } - - @XmlElement(name="SubjectDN") - public String getSubjectDN() { - return subjectDN; - } - - public void setSubjectDN(String subjectDN) { - this.subjectDN = subjectDN; - } - - @XmlElement(name="PrettyPrint") - public String getPrettyPrint() { - return prettyPrint; - } - - public void setPrettyPrint(String prettyPrint) { - this.prettyPrint = prettyPrint; - } - - @XmlElement(name="Encoded") - public String getEncoded() { - return encoded; - } - - public void setEncoded(String encoded) { - this.encoded = encoded; - } - - @XmlElement(name="PKCS7CertChain") - public void setPkcs7CertChain(String chain) { - this.pkcs7CertChain = chain; - } - - public String getPkcs7CertChain() { - return pkcs7CertChain; - } - - @XmlElement(name="NotBefore") - public String getNotBefore() { - return notBefore; - } - - public void setNotBefore(String notBefore) { - this.notBefore = notBefore; - } - - @XmlElement(name="NotAfter") - public String getNotAfter() { - return notAfter; - } - - public void setNotAfter(String notAfter) { - this.notAfter = notAfter; - } - - @XmlElement(name="Status") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @XmlElement(name="Link") - public Link getLink() { - return link; - } - - public void setLink(Link link) { - this.link = link; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((encoded == null) ? 0 : encoded.hashCode()); - result = prime * result + ((issuerDN == null) ? 0 : issuerDN.hashCode()); - result = prime * result + ((notAfter == null) ? 0 : notAfter.hashCode()); - result = prime * result + ((notBefore == null) ? 0 : notBefore.hashCode()); - result = prime * result + ((pkcs7CertChain == null) ? 0 : pkcs7CertChain.hashCode()); - result = prime * result + ((prettyPrint == null) ? 0 : prettyPrint.hashCode()); - result = prime * result + ((serialNumber == null) ? 0 : serialNumber.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((subjectDN == null) ? 0 : subjectDN.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; - CertData other = (CertData) obj; - if (encoded == null) { - if (other.encoded != null) - return false; - } else if (!encoded.equals(other.encoded)) - return false; - if (issuerDN == null) { - if (other.issuerDN != null) - return false; - } else if (!issuerDN.equals(other.issuerDN)) - return false; - if (notAfter == null) { - if (other.notAfter != null) - return false; - } else if (!notAfter.equals(other.notAfter)) - return false; - if (notBefore == null) { - if (other.notBefore != null) - return false; - } else if (!notBefore.equals(other.notBefore)) - return false; - if (pkcs7CertChain == null) { - if (other.pkcs7CertChain != null) - return false; - } else if (!pkcs7CertChain.equals(other.pkcs7CertChain)) - return false; - if (prettyPrint == null) { - if (other.prettyPrint != null) - return false; - } else if (!prettyPrint.equals(other.prettyPrint)) - return false; - if (serialNumber == null) { - if (other.serialNumber != null) - return false; - } else if (!serialNumber.equals(other.serialNumber)) - return false; - if (status == null) { - if (other.status != null) - return false; - } else if (!status.equals(other.status)) - return false; - if (subjectDN == null) { - if (other.subjectDN != null) - return false; - } else if (!subjectDN.equals(other.subjectDN)) - 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 CertData valueOf(String string) throws Exception { - try { - return (CertData)unmarshaller.unmarshal(new StringReader(string)); - } catch (Exception e) { - return null; - } - } - - public static void main(String args[]) throws Exception { - - StringWriter sw = new StringWriter(); - PrintWriter out = new PrintWriter(sw, true); - - out.println("-----BEGIN CERTIFICATE-----"); - out.println("MIIB/zCCAWgCCQCtpWH58pqsejANBgkqhkiG9w0BAQUFADBEMRQwEgYDVQQKDAtF"); - out.println("WEFNUExFLUNPTTEYMBYGCgmSJomT8ixkAQEMCHRlc3R1c2VyMRIwEAYDVQQDDAlU"); - out.println("ZXN0IFVzZXIwHhcNMTIwNTE0MTcxNzI3WhcNMTMwNTE0MTcxNzI3WjBEMRQwEgYD"); - out.println("VQQKDAtFWEFNUExFLUNPTTEYMBYGCgmSJomT8ixkAQEMCHRlc3R1c2VyMRIwEAYD"); - out.println("VQQDDAlUZXN0IFVzZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKmmiPJp"); - out.println("Agh/gPUAZjfgJ3a8QiHvpMzZ/hZy1FVP3+2sNhCkMv+D/I8Y7AsrbJGxxvD7bTDm"); - out.println("zQYtYx2ryGyOgY7KBRxEj/IrNVHIkJMYq5G/aIU4FAzpc6ntNSwUQBYUAamfK8U6"); - out.println("Wo4Cp6rLePXIDE6sfGn3VX6IeSJ8U2V+vwtzAgMBAAEwDQYJKoZIhvcNAQEFBQAD"); - out.println("gYEAY9bjcD/7Z+oX6gsJtX6Rd79E7X5IBdOdArYzHNE4vjdaQrZw6oCxrY8ffpKC"); - out.println("0T0q5PX9I7er+hx/sQjGPMrJDEN+vFBSNrZE7sTeLRgkyiqGvChSyuG05GtGzXO4"); - out.println("bFBr+Gwk2VF2wJvOhTXU2hN8sfkkd9clzIXuL8WCDhWk1bY="); - out.println("-----END CERTIFICATE-----"); - - CertData before = new CertData(); - before.setSerialNumber(new CertId("12512514865863765114")); - before.setIssuerDN("CN=Test User,UID=testuser,O=EXAMPLE-COM"); - before.setSubjectDN("CN=Test User,UID=testuser,O=EXAMPLE-COM"); - before.setEncoded(sw.toString()); - - String string = before.toString(); - System.out.println(string); - - CertData after = CertData.valueOf(string); - System.out.println(before.equals(after)); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfo.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfo.java deleted file mode 100644 index 4c6a9b19e..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfo.java +++ /dev/null @@ -1,173 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -/** - * - */ -package com.netscape.cms.servlet.cert.model; - -import java.io.StringReader; -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import org.jboss.resteasy.plugins.providers.atom.Link; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.certsrv.dbs.certdb.CertIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name = "CertDataInfo") -public class CertDataInfo { - - public static Marshaller marshaller; - public static Unmarshaller unmarshaller; - - static { - try { - JAXBContext context = JAXBContext.newInstance(CertDataInfo.class); - marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - unmarshaller = context.createUnmarshaller(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - CertId id; - String subjectDN; - String status; - - Link link; - - @XmlAttribute(name="id") - @XmlJavaTypeAdapter(CertIdAdapter.class) - public CertId getID() { - return id; - } - - public void setID(CertId id) { - this.id = id; - } - - @XmlElement(name="SubjectDN") - public String getSubjectDN() { - return subjectDN; - } - - public void setSubjectDN(String subjectDN) { - this.subjectDN = subjectDN; - } - - @XmlElement(name="Status") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @XmlElement(name="Link") - public Link getLink() { - return link; - } - - public void setLink(Link link) { - this.link = link; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((subjectDN == null) ? 0 : subjectDN.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; - CertDataInfo other = (CertDataInfo) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (status == null) { - if (other.status != null) - return false; - } else if (!status.equals(other.status)) - return false; - if (subjectDN == null) { - if (other.subjectDN != null) - return false; - } else if (!subjectDN.equals(other.subjectDN)) - 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 CertDataInfo valueOf(String string) throws Exception { - try { - return (CertDataInfo)unmarshaller.unmarshal(new StringReader(string)); - } catch (Exception e) { - return null; - } - } - - public static void main(String args[]) throws Exception { - - CertDataInfo before = new CertDataInfo(); - before.setID(new CertId("12512514865863765114")); - before.setSubjectDN("CN=Test User,UID=testuser,O=EXAMPLE-COM"); - before.setStatus("VALID"); - - String string = before.toString(); - System.out.println(string); - - CertDataInfo after = CertDataInfo.valueOf(string); - - System.out.println(before.equals(after)); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfos.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfos.java deleted file mode 100644 index 189c58cbe..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/CertDataInfos.java +++ /dev/null @@ -1,72 +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.cms.servlet.cert.model; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; - -import org.jboss.resteasy.plugins.providers.atom.Link; - -@XmlRootElement(name = "CertDataInfos") -public class CertDataInfos { - - protected Collection<CertDataInfo> certInfos = new ArrayList<CertDataInfo>(); - protected List<Link> links = new ArrayList<Link>(); - - /** - * @return the CertInfos - */ - @XmlElementRef - public Collection<CertDataInfo> getCertInfos() { - return certInfos; - } - - /** - * @param certInfos the CertInfos to set - */ - public void setCertInfos(Collection<CertDataInfo> certInfos) { - this.certInfos = certInfos; - } - - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - public void addCertData(CertDataInfo certInfo){ - this.certInfos.add(certInfo); - } - - public void addLink(Link link) { - this.links.add(link); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertRevokeRequest.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertRevokeRequest.java deleted file mode 100644 index ef9ccebc3..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/CertRevokeRequest.java +++ /dev/null @@ -1,205 +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.cms.servlet.cert.model; - -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Date; - -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 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; - -/** - * @author Endi S. Dewata - */ -@XmlRootElement(name="CertRevokeRequest") -public class CertRevokeRequest { - - public static Marshaller marshaller; - public static Unmarshaller unmarshaller; - - static { - try { - JAXBContext context = JAXBContext.newInstance(CertRevokeRequest.class); - marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - unmarshaller = context.createUnmarshaller(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - RequestId requestID; - RevocationReason reason; - Date invalidityDate; - String comments; - String encoded; - - - @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) - public RevocationReason getReason() { - return reason; - } - - public void setReason(RevocationReason reason) { - this.reason = reason; - } - - @XmlElement(name="InvalidityDate") - @FormParam("invalidityDate") - @XmlJavaTypeAdapter(DateAdapter.class) - public Date getInvalidityDate() { - return invalidityDate; - } - - public void setInvalidityDate(Date invalidityDate) { - this.invalidityDate = invalidityDate; - } - - @XmlElement(name="Comments") - @FormParam(IRequest.REQUESTOR_COMMENTS) - public String getComments() { - return comments; - } - - public void setComments(String comments) { - this.comments = comments; - } - - @XmlElement(name="Encoded") - @FormParam("b64eCertificate") - public String getEncoded() { - return encoded; - } - - public void setEncoded(String encoded) { - this.encoded = encoded; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((comments == null) ? 0 : comments.hashCode()); - result = prime * result + ((encoded == null) ? 0 : encoded.hashCode()); - result = prime * result + ((invalidityDate == null) ? 0 : invalidityDate.hashCode()); - result = prime * result + ((reason == null) ? 0 : reason.hashCode()); - 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; - CertRevokeRequest other = (CertRevokeRequest) obj; - if (comments == null) { - if (other.comments != null) - return false; - } else if (!comments.equals(other.comments)) - return false; - if (encoded == null) { - if (other.encoded != null) - return false; - } else if (!encoded.equals(other.encoded)) - return false; - if (invalidityDate == null) { - if (other.invalidityDate != null) - return false; - } else if (!invalidityDate.equals(other.invalidityDate)) - return false; - if (reason == null) { - if (other.reason != null) - 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; - } - - public String toString() { - try { - StringWriter sw = new StringWriter(); - marshaller.marshal(this, sw); - return sw.toString(); - - } catch (Exception e) { - return super.toString(); - } - } - - public static CertRevokeRequest valueOf(String string) throws Exception { - try { - return (CertRevokeRequest)unmarshaller.unmarshal(new StringReader(string)); - } catch (Exception e) { - return null; - } - } - - 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"); - before.setEncoded("test"); - - String string = before.toString(); - System.out.println(string); - - CertRevokeRequest after = CertRevokeRequest.valueOf(string); - - System.out.println(before.equals(after)); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertSearchRequest.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertSearchRequest.java deleted file mode 100644 index 54b9ad8e6..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/CertSearchRequest.java +++ /dev/null @@ -1,862 +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) 2011 Red Hat, Inc. -//All rights reserved. -//--- END COPYRIGHT BLOCK --- - -// TODO: This class is brute force. Come up with a way to divide these search filter entities into -// smaller classes -package com.netscape.cms.servlet.cert.model; - -import java.io.Reader; -import java.util.Calendar; -import java.util.StringTokenizer; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.cmsutil.ldap.LDAPUtil; - -/** - * @author jmagne - * - */ -@XmlRootElement(name = "CertSearchRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertSearchRequest { - - private final static String MATCH_EXACTLY = "exact"; - //Serial Number - @XmlElement - protected boolean serialNumberRangeInUse; - - @XmlElement - protected String serialTo; - - @XmlElement - protected String serialFrom; - - //Subject Name - @XmlElement - protected boolean subjectInUse; - - @XmlElement - protected String eMail; - - @XmlElement - protected String commonName; - - @XmlElement - protected String userID; - - @XmlElement - protected String orgUnit; - - @XmlElement - protected String org; - - @XmlElement - protected String locality; - - @XmlElement - protected String state; - - @XmlElement - protected String country; - - @XmlElement - protected boolean matchExactly; - - //Revoked By - - @XmlElement - protected String revokedBy; - - //Revoked On - - @XmlElement - protected String revokedOnFrom; - - @XmlElement - protected String revokedOnTo; - - //Revocation Reason - - @XmlElement - protected String revocationReason; - - //Issued By - - @XmlElement - protected String issuedBy; - - //Issued On - - @XmlElement - protected String issuedOnFrom; - - @XmlElement - protected String issuedOnTo; - - //Valid Not Before - - @XmlElement - protected String validNotBeforeFrom; - - @XmlElement - protected String validNotBeforeTo; - - //Valid Not After - - @XmlElement - protected String validNotAfterFrom; - - @XmlElement - protected String validNotAfterTo; - - //Validity Length - - @XmlElement - protected String validityOperation; - - @XmlElement - protected String validityCount; - - @XmlElement - protected String validityUnit; - - // Cert Type - - @XmlElement - protected String certTypeSubEmailCA; - - @XmlElement - protected String certTypeSubSSLCA; - - @XmlElement - protected String certTypeSecureEmail; - - @XmlElement - protected String certTypeSSLClient; - - @XmlElement - protected String certTypeSSLServer; - - //Revoked By - @XmlElement - protected boolean revokedByInUse; - - //Revoked On - @XmlElement - protected boolean revokedOnInUse; - - @XmlElement - protected boolean revocationReasonInUse; - - @XmlElement - protected boolean issuedByInUse; - - @XmlElement - protected boolean issuedOnInUse; - - @XmlElement - protected boolean validNotBeforeInUse; - - @XmlElement - protected boolean validNotAfterInUse; - - @XmlElement - protected boolean validityLengthInUse; - - @XmlElement - protected boolean certTypeInUse; - - //Boolean values - public boolean getSerialNumberRangeInUse() { - return serialNumberRangeInUse; - } - - public void setSerialNumberRangeInUse(boolean serialNumberRangeInUse) { - this.serialNumberRangeInUse = serialNumberRangeInUse; - } - - public boolean getSubjectInUse() { - return subjectInUse; - } - - public void setSubjectInUse(boolean subjectInUse) { - this.subjectInUse = subjectInUse; - } - - public boolean getRevokedByInUse() { - return revokedByInUse; - } - - public void setRevokedByInUse(boolean revokedByInUse) { - this.revokedByInUse = revokedByInUse; - } - - public boolean getRevokedOnInUse() { - return revokedOnInUse; - } - - public void setRevokedOnInUse(boolean revokedOnInUse) { - this.revokedOnInUse = revokedOnInUse; - } - - public void setRevocationReasonInUse(boolean revocationReasonInUse) { - this.revocationReasonInUse = revocationReasonInUse; - } - - public boolean getRevocationReasonInUse() { - return revocationReasonInUse; - } - - public void setIssuedByInUse(boolean issuedByInUse) { - this.issuedByInUse = issuedByInUse; - } - - public boolean getIssuedByInUse() { - return issuedByInUse; - } - - public void setIssuedOnInUse(boolean issuedOnInUse) { - this.issuedOnInUse = issuedOnInUse; - } - - public boolean getIssuedOnInUse() { - return issuedOnInUse; - } - - public void setValidNotBeforeInUse(boolean validNotBeforeInUse) { - this.validNotBeforeInUse = validNotBeforeInUse; - } - - public boolean getValidNotBeforeInUse() { - return validNotBeforeInUse; - } - - public void setValidNotAfterInUse(boolean validNotAfterInUse) { - this.validNotAfterInUse = validNotAfterInUse; - } - - public boolean getValidNotAfterInUse() { - return validNotAfterInUse; - } - - public void setValidityLengthInUse(boolean validityLengthInUse) { - this.validityLengthInUse = validityLengthInUse; - } - - public boolean getValidityLengthInUse() { - return validityLengthInUse; - } - - public void setCertTypeInUse(boolean certTypeInUse) { - this.certTypeInUse = certTypeInUse; - } - - public boolean getCertTypeInUse() { - return certTypeInUse; - } - - //Actual Values - - public String getSerialTo() { - return serialTo; - } - - public void setSerialTo(String serialTo) { - this.serialTo = serialTo; - } - - public String getSerialFrom() { - return serialFrom; - } - - public void setSerialFrom(String serialFrom) { - this.serialFrom = serialFrom; - } - - //Subject Name - - public String getEmail() { - return eMail; - } - - public void setEmail(String email) { - this.eMail = email; - } - - public String getCommonName() { - return commonName; - } - - public void setCommonName(String commonName) { - this.commonName = commonName; - } - - public String getUserID() { - return userID; - } - - public void setUserID(String userID) { - this.userID = userID; - } - - public String getOrgUnit() { - return orgUnit; - } - - public void setOrgUnit(String orgUnit) { - this.orgUnit = orgUnit; - } - - public String getOrg() { - return org; - } - - public void setOrg(String org) { - this.org = org; - } - - public String getLocality() { - return locality; - } - - public void setLocality(String locality) { - this.locality = locality; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public boolean getMatchExactly() { - return matchExactly; - } - - public void setMatchExactly(boolean matchExactly) { - this.matchExactly = matchExactly; - } - - //Revoked On - - public String getRevokedOnTo() { - return revokedOnTo; - } - - public void setRevokedOnTo(String revokedOnTo) { - this.revokedOnTo = revokedOnTo; - } - - public String getRevokedOnFrom() { - return revokedOnFrom; - } - - public void setRevokedOnFrom(String revokedOnFrom) { - this.revokedOnFrom = revokedOnFrom; - } - - //Revoked By - - public String getRevokedBy() { - return revokedBy; - } - - public void setRevokedBy(String revokedBy) { - this.revokedBy = revokedBy; - } - - //Revocation Reason - - public String getRevocationReason() { - return revocationReason; - } - - public void setRevocationReason(String revocationReason) { - this.revocationReason = revocationReason; - } - - //Issued By - - public String getIssuedBy() { - return issuedBy; - } - - public void setIssuedBy(String issuedBy) { - this.issuedBy = issuedBy; - } - - //Issued On - - public String getIssuedOnFrom() { - return issuedOnFrom; - } - - public void setIssuedOnFrom(String issuedOnFrom) { - this.issuedOnFrom = issuedOnFrom; - } - - public String getIssuedOnTo() { - return getIssuedOnTo(); - } - - //Valid Not After - - public String getValidNotAfterFrom() { - return validNotAfterFrom; - } - - public void setValidNotAfterFrom(String validNotAfterFrom) { - this.validNotAfterFrom = validNotAfterFrom; - } - - public String getValidNotAfterTo() { - return validNotAfterTo; - } - - public void setValidNotAfterTo(String validNotAfterTo) { - this.validNotAfterTo = validNotAfterTo; - } - - //Valid Not Before - - public String getValidNotBeforeFrom() { - return validNotBeforeFrom; - } - - public void setValidNotBeforeFrom(String validNotBeforeFrom) { - this.validNotBeforeFrom = validNotBeforeFrom; - } - - public String getValidNotBeforeTo() { - return validNotBeforeTo; - } - - public void setValidNotBeforeTo(String validNotBeforeTo) { - this.validNotBeforeTo = validNotBeforeTo; - } - - //Validity Length - - public String getValidityOperation() { - return validityOperation; - } - - public void setValidityOperation(String validityOperation) { - this.validityOperation = validityOperation; - } - - public String getValidityUnit() { - return validityUnit; - } - - public void setValidityUnit(String validityUnit) { - this.validityUnit = validityUnit; - } - - public String getValidityCount() { - return validityCount; - } - - public void setValidityCount(String validityCount) { - this.validityCount = validityCount; - } - - //Cert Type - - public String getCertTypeSubEmailCA() { - return certTypeSubEmailCA; - } - - public void setCertTypeSubEmailCA(String certTypeSubEmailCA) { - this.certTypeSubEmailCA = certTypeSubEmailCA; - } - - public String getCertTypeSubSSLCA() { - return certTypeSubSSLCA; - } - - public void setCertTypeSubSSLCA(String certTypeSubSSLCA) { - this.certTypeSubSSLCA = certTypeSubSSLCA; - } - - public String getCertTypeSecureEmail() { - return certTypeSecureEmail; - } - - public void setCertTypeSecureEmail(String certTypeSecureEmail) { - this.certTypeSecureEmail = certTypeSecureEmail; - } - - public String getCertTypeSSLClient() { - return certTypeSSLClient; - } - - public void setCertTypeSSLClient(String SSLClient) { - this.certTypeSSLClient = SSLClient; - } - - public String getCertTypeSSLServer() { - return certTypeSSLServer; - } - - public void setCertTypeSSLServer(String SSLServer) { - this.certTypeSSLServer = SSLServer; - } - - public CertSearchRequest() { - // required for JAXB (defaults) - } - - public void buildFromServletRequest(HttpServletRequest req) { - //Set values from the servlet request - if (req == null) { - return; - } - } - - public CertSearchRequest(MultivaluedMap<String, String> form) { - } - - public String buildFilter() { - StringBuffer filter = new StringBuffer(); - buildSerialNumberRangeFilter(filter); - buildSubjectFilter(filter); - buildRevokedByFilter(filter); - buildRevokedOnFilter(filter); - buildRevocationReasonFilter(filter); - buildIssuedByFilter(filter); - buildIssuedOnFilter(filter); - buildValidNotBeforeFilter(filter); - buildValidNotAfterFilter(filter); - buildValidityLengthFilter(filter); - buildCertTypeFilter(filter); - - searchFilter = filter.toString(); - - if (searchFilter != null && !searchFilter.equals("")) { - searchFilter = "(&" + searchFilter + ")"; - } - - return searchFilter; - } - - private void buildSerialNumberRangeFilter(StringBuffer filter) { - - if (!getSerialNumberRangeInUse()) { - return; - } - boolean changed = false; - String serialFrom = getSerialFrom(); - if (serialFrom != null && !serialFrom.equals("")) { - filter.append("(certRecordId>=" + LDAPUtil.escapeFilter(serialFrom) + ")"); - changed = true; - } - String serialTo = getSerialTo(); - if (serialTo != null && !serialTo.equals("")) { - filter.append("(certRecordId<=" + LDAPUtil.escapeFilter(serialTo) + ")"); - changed = true; - } - if (!changed) { - filter.append("(certRecordId=*)"); - } - - } - - private void buildSubjectFilter(StringBuffer filter) { - if (!getSubjectInUse()) { - return; - } - StringBuffer lf = new StringBuffer(); - - String matchStr = null; - boolean match = getMatchExactly(); - - if (match == true) { - matchStr = MATCH_EXACTLY; - } - - buildAVAFilter(getEmail(), "E", lf, matchStr); - buildAVAFilter(getCommonName(), "CN", lf, matchStr); - buildAVAFilter(getUserID(), "UID", lf, matchStr); - buildAVAFilter(getOrgUnit(), "OU", lf, matchStr); - buildAVAFilter(getOrg(), "O", lf, matchStr); - buildAVAFilter(getLocality(), "L", lf, matchStr); - buildAVAFilter(getState(), "ST", lf, matchStr); - buildAVAFilter(getCountry(), "C", lf, matchStr); - - if (lf.length() == 0) { - filter.append("(x509cert.subject=*)"); - return; - } - if (matchStr != null && matchStr.equals(MATCH_EXACTLY)) { - filter.append("(&"); - filter.append(lf); - filter.append(")"); - } else { - filter.append("(|"); - filter.append(lf); - filter.append(")"); - } - } - - private void buildRevokedByFilter(StringBuffer filter) { - if (!getRevokedByInUse()) { - return; - } - - String revokedBy = getRevokedBy(); - if (revokedBy == null || revokedBy.equals("")) { - filter.append("(certRevokedBy=*)"); - } else { - filter.append("(certRevokedBy="); - filter.append(LDAPUtil.escapeFilter(revokedBy)); - filter.append(")"); - } - } - - private void buildDateFilter(String prefix, - String outStr, long adjustment, - StringBuffer filter) { - long epoch = 0; - try { - epoch = Long.parseLong(prefix); - } catch (NumberFormatException e) { - // exception safely ignored - } - Calendar from = Calendar.getInstance(); - from.setTimeInMillis(epoch); - filter.append("("); - filter.append(LDAPUtil.escapeFilter(outStr)); - filter.append(Long.toString(from.getTimeInMillis() + adjustment)); - filter.append(")"); - } - - private void buildRevokedOnFilter(StringBuffer filter) { - if (!getRevokedOnInUse()) { - return; - } - buildDateFilter(getRevokedOnFrom(), "certRevokedOn>=", 0, filter); - buildDateFilter(getRevokedOnTo(), "certRevokedOn<=", 86399999, filter); - } - - private void buildRevocationReasonFilter(StringBuffer filter) { - if (!getRevocationReasonInUse()) { - return; - } - String reasons = getRevocationReason(); - if (reasons == null) { - return; - } - String queryCertFilter = null; - StringTokenizer st = new StringTokenizer(reasons, ","); - if (st.hasMoreTokens()) { - filter.append("(|"); - while (st.hasMoreTokens()) { - String token = st.nextToken(); - if (queryCertFilter == null) { - queryCertFilter = ""; - } - filter.append("(x509cert.certRevoInfo="); - filter.append(LDAPUtil.escapeFilter(token)); - filter.append(")"); - } - filter.append(")"); - } - } - - private void buildIssuedByFilter(StringBuffer filter) { - if (!getIssuedByInUse()) { - return; - } - String issuedBy = getIssuedBy(); - ; - if (issuedBy == null || issuedBy.equals("")) { - filter.append("(certIssuedBy=*)"); - } else { - filter.append("(certIssuedBy="); - filter.append(LDAPUtil.escapeFilter(issuedBy)); - filter.append(")"); - } - } - - private void buildIssuedOnFilter(StringBuffer filter) { - if (!getIssuedOnInUse()) { - return; - } - buildDateFilter(getIssuedOnFrom(), "certCreateTime>=", 0, filter); - buildDateFilter(getIssuedOnTo(), "certCreateTime<=", 86399999, filter); - } - - private void buildValidNotBeforeFilter(StringBuffer filter) { - if (!getValidNotBeforeInUse()) { - return; - } - buildDateFilter(validNotBeforeFrom, "x509cert.notBefore>=", 0, filter); - buildDateFilter(validNotBeforeTo, "x509cert.notBefore<=", 86399999, filter); - - } - - private void buildValidNotAfterFilter(StringBuffer filter) { - if (!getValidNotAfterInUse()) { - return; - } - buildDateFilter(getValidNotAfterFrom(), "x509cert.notAfter>=", 0, filter); - buildDateFilter(getValidNotAfterTo(), "x509cert.notAfter<=", 86399999, filter); - - } - - private void buildValidityLengthFilter(StringBuffer filter) { - if (!getValidityLengthInUse()) { - return; - } - String op = getValidityOperation(); - long count = 0; - try { - count = Long.parseLong(getValidityCount()); - } catch (NumberFormatException e) { - // safely ignore - } - long unit = 0; - try { - unit = Long.parseLong(getValidityUnit()); - } catch (NumberFormatException e) { - // safely ignore - } - filter.append("("); - filter.append("x509cert.duration"); - filter.append(LDAPUtil.escapeFilter(op)); - filter.append(count * unit); - filter.append(")"); - } - - private void buildCertTypeFilter(StringBuffer filter) { - if (!getCertTypeInUse()) { - return; - } - if (isOn(getCertTypeSSLClient())) { - filter.append("(x509cert.nsExtension.SSLClient=on)"); - } else if (isOff(getCertTypeSSLClient())) { - filter.append("(x509cert.nsExtension.SSLClient=off)"); - } - if (isOn(getCertTypeSSLServer())) { - filter.append("(x509cert.nsExtension.SSLServer=on)"); - } else if (isOff(getCertTypeSSLServer())) { - filter.append("(x509cert.nsExtension.SSLServer=off)"); - } - if (isOn(getCertTypeSecureEmail())) { - filter.append("(x509cert.nsExtension.SecureEmail=on)"); - } else if (isOff(getCertTypeSecureEmail())) { - filter.append("(x509cert.nsExtension.SecureEmail=off)"); - } - if (isOn(getCertTypeSubSSLCA())) { - filter.append("(x509cert.nsExtension.SubordinateSSLCA=on)"); - } else if (isOff(getCertTypeSubSSLCA())) { - filter.append("(x509cert.nsExtension.SubordinateSSLCA=off)"); - } - if (isOn(getCertTypeSubEmailCA())) { - filter.append("(x509cert.nsExtension.SubordinateEmailCA=on)"); - } else if (isOff(getCertTypeSubEmailCA())) { - filter.append("(x509cert.nsExtension.SubordinateEmailCA=off)"); - } - } - - private boolean isOn(String value) { - String inUse = value; - if (inUse == null) { - return false; - } - if (inUse.equals("on")) { - return true; - } - return false; - } - - private boolean isOff(String value) { - String inUse = value; - if (inUse == null) { - return false; - } - if (inUse.equals("off")) { - return true; - } - return false; - } - - private void buildAVAFilter(String param, - String avaName, StringBuffer lf, String match) { - if (param != null && !param.equals("")) { - if (match != null && match.equals(MATCH_EXACTLY)) { - lf.append("(|"); - lf.append("(x509cert.subject=*"); - lf.append(avaName); - lf.append("="); - lf.append(LDAPUtil.escapeFilter(LDAPUtil.escapeDN(param, false))); - lf.append(",*)"); - lf.append("(x509cert.subject=*"); - lf.append(avaName); - lf.append("="); - lf.append(LDAPUtil.escapeFilter(LDAPUtil.escapeDN(param, false))); - lf.append(")"); - lf.append(")"); - } else { - lf.append("(x509cert.subject=*"); - lf.append(avaName); - lf.append("="); - lf.append("*"); - lf.append(LDAPUtil.escapeFilter(LDAPUtil.escapeDN(param, false))); - lf.append("*)"); - } - } - - } - - private String searchFilter = null; - - public String getSearchFilter() { - return searchFilter; - } - - public void setSearchFilter(String searchFilter) { - this.searchFilter = searchFilter; - } - - public static CertSearchRequest valueOf(Reader reader) throws JAXBException { - JAXBContext context = JAXBContext.newInstance(CertSearchRequest.class); - Unmarshaller unmarshaller = context.createUnmarshaller(); - return (CertSearchRequest) unmarshaller.unmarshal(reader); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/cert/model/CertUnrevokeRequest.java b/base/common/src/com/netscape/cms/servlet/cert/model/CertUnrevokeRequest.java deleted file mode 100644 index 98d24d363..000000000 --- a/base/common/src/com/netscape/cms/servlet/cert/model/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.cms.servlet.cert.model; - -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)); - } -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java index 4c9caf5c1..4397251b5 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java @@ -140,13 +140,13 @@ import com.netscape.certsrv.dbs.crldb.ICRLIssuingPointRecord; import com.netscape.certsrv.ldap.ILdapConnFactory; import com.netscape.certsrv.ocsp.IDefStore; import com.netscape.certsrv.ocsp.IOCSPAuthority; +import com.netscape.certsrv.system.InstallToken; +import com.netscape.certsrv.system.InstallTokenRequest; import com.netscape.certsrv.usrgrp.IGroup; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; import com.netscape.cms.client.ClientConfig; import com.netscape.cms.client.system.SystemConfigClient; -import com.netscape.cms.servlet.csadmin.model.InstallToken; -import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest; import com.netscape.cmsutil.crypto.CryptoUtil; import com.netscape.cmsutil.http.HttpClient; import com.netscape.cmsutil.http.HttpRequest; diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java deleted file mode 100644 index 9cb6791e3..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigResource.java +++ /dev/null @@ -1,63 +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.cms.servlet.csadmin; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; - -import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest; -import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse; -import com.netscape.cms.servlet.csadmin.model.DomainInfo; -import com.netscape.cms.servlet.csadmin.model.InstallToken; -import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest; - -/** - * @author alee - */ -@Path("installer") -public interface SystemConfigResource { - - @POST - @Path("configure") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public ConfigurationResponse configure(MultivaluedMap<String, String> form); - - @POST - @Path("configure") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ConfigurationResponse configure(ConfigurationRequest data); - - @POST - @Path("installToken") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public InstallToken getInstallToken(InstallTokenRequest data); - - @GET - @Path("domainInfo") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public DomainInfo getDomainInfo(); -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java index b17cf1752..c7560fbc4 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/SystemConfigService.java @@ -47,19 +47,20 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISecurityDomainSessionTable; +import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.ocsp.IOCSPAuthority; +import com.netscape.certsrv.system.ConfigurationRequest; +import com.netscape.certsrv.system.ConfigurationResponse; +import com.netscape.certsrv.system.DomainInfo; +import com.netscape.certsrv.system.InstallToken; +import com.netscape.certsrv.system.InstallTokenRequest; +import com.netscape.certsrv.system.SystemCertData; +import com.netscape.certsrv.system.SystemConfigResource; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; -import com.netscape.cms.servlet.base.PKIException; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.csadmin.model.ConfigurationResponse; -import com.netscape.cms.servlet.csadmin.model.DomainInfo; -import com.netscape.cms.servlet.csadmin.model.InstallToken; -import com.netscape.cms.servlet.csadmin.model.InstallTokenRequest; -import com.netscape.cms.servlet.csadmin.model.SystemCertData; -import com.netscape.cms.servlet.csadmin.model.ConfigurationRequest; import com.netscape.cmsutil.crypto.CryptoUtil; import com.netscape.cmsutil.util.Utils; diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java deleted file mode 100644 index b42403f4e..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationRequest.java +++ /dev/null @@ -1,724 +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.cms.servlet.csadmin.model; - -import java.util.Collection; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="ConfigurationRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class ConfigurationRequest { - private static final String PIN = "pin"; - private static final String TOKEN = "token"; - private static final String TOKEN_PASSWORD = "tokenPassword"; - private static final String SECURITY_DOMAIN_TYPE = "securityDomainType"; - private static final String SECURITY_DOMAIN_URI = "securityDomainUri"; - private static final String SECURITY_DOMAIN_NAME = "securityDomainName"; - private static final String SECURITY_DOMAIN_USER = "securityDomainUser"; - private static final String SECURITY_DOMAIN_PASSWORD = "securityDomainPassword"; - private static final String IS_CLONE = "isClone"; - private static final String CLONE_URI = "cloneUri"; - private static final String SUBSYSTEM_NAME = "subsystemName"; - private static final String P12_FILE = "p12File"; - private static final String P12_PASSWORD = "p12Password"; - private static final String HIERARCHY = "hierarchy"; - private static final String DSHOST = "dsHost"; - private static final String DSPORT = "dsPort"; - private static final String BASEDN = "basedn"; - private static final String BINDDN = "binddn"; - private static final String DATABASE = "database"; - private static final String SECURECONN = "secureConn"; - private static final String REMOVEDATA = "removeData"; - private static final String MASTER_REPLICATION_PORT = "masterReplicationPort"; - private static final String CLONE_REPLICATION_PORT = "cloneReplicationPort"; - private static final String REPLICATION_SECURITY = "replicationSecurity"; - private static final String ISSUING_CA = "issuingCa"; - private static final String BACKUP_KEYS = "backupKeys"; - private static final String BACKUP_FILE = "backupFile"; - private static final String BACKUP_PASSWORD = "backupPassword"; - private static final String ADMIN_UID = "adminUid"; - private static final String ADMIN_EMAIL = "adminEmail"; - private static final String ADMIN_PASSWORD = "adminPassword"; - private static final String ADMIN_CERT_REQUEST = "adminCertRequest"; - private static final String ADMIN_CERT_REQUEST_TYPE = "adminCertRequestType"; - private static final String ADMIN_SUBJECT_DN = "adminSubjectDN"; - private static final String ADMIN_NAME = "adminName"; - private static final String ADMIN_PROFILE_ID = "adminProfileID"; - private static final String STEP_TWO = "stepTwo"; - - //defaults - public static final String TOKEN_DEFAULT = "Internal Key Storage Token"; - public static final String NEW_DOMAIN = "newdomain"; - public static final String EXISTING_DOMAIN = "existingdomain"; - - @XmlElement - protected String pin; - - @XmlElement(defaultValue=TOKEN_DEFAULT) - protected String token; - - @XmlElement - protected String tokenPassword; - - @XmlElement - protected String securityDomainType; - - @XmlElement - protected String securityDomainUri; - - @XmlElement - protected String securityDomainName; - - @XmlElement - protected String securityDomainUser; - - @XmlElement - protected String securityDomainPassword; - - @XmlElement(defaultValue="false") - protected String isClone; - - @XmlElement - protected String cloneUri; - - @XmlElement - protected String subsystemName; - - @XmlElement - protected String p12File; - - @XmlElement - protected String p12Password; - - @XmlElement - protected String hierarchy; - - @XmlElement - protected String dsHost; - - @XmlElement - protected String dsPort; - - @XmlElement - protected String baseDN; - - @XmlElement - protected String bindDN; - - @XmlElement - protected String bindpwd; - - @XmlElement - protected String database; - - @XmlElement(defaultValue = "off") - protected String secureConn; - - @XmlElement - protected String removeData; - - @XmlElement - protected String masterReplicationPort; - - @XmlElement - protected String cloneReplicationPort; - - @XmlElement - protected String replicationSecurity; - - @XmlElementRef - protected Collection<SystemCertData> systemCerts; - - @XmlElement - protected String issuingCA; - - @XmlElement - protected String backupKeys; - - @XmlElement - protected String backupPassword; - - @XmlElement - protected String backupFile; - - @XmlElement - protected String adminUID; - - @XmlElement - protected String adminPassword; - - @XmlElement - protected String adminEmail; - - @XmlElement - protected String adminCertRequest; - - @XmlElement - protected String adminCertRequestType; - - @XmlElement - protected String adminSubjectDN; - - @XmlElement - protected String adminName; - - @XmlElement - protected String adminProfileID; - - @XmlElement - protected String stepTwo; - - public ConfigurationRequest() { - // required for JAXB - } - - public ConfigurationRequest(MultivaluedMap<String, String> form) { - pin = form.getFirst(PIN); - token = form.getFirst(TOKEN); - tokenPassword = form.getFirst(TOKEN_PASSWORD); - securityDomainType = form.getFirst(SECURITY_DOMAIN_TYPE); - securityDomainUri = form.getFirst(SECURITY_DOMAIN_URI); - securityDomainName = form.getFirst(SECURITY_DOMAIN_NAME); - securityDomainUser = form.getFirst(SECURITY_DOMAIN_USER); - securityDomainPassword = form.getFirst(SECURITY_DOMAIN_PASSWORD); - isClone = form.getFirst(IS_CLONE); - cloneUri = form.getFirst(CLONE_URI); - subsystemName = form.getFirst(SUBSYSTEM_NAME); - p12File = form.getFirst(P12_FILE); - p12Password = form.getFirst(P12_PASSWORD); - hierarchy = form.getFirst(HIERARCHY); - dsHost = form.getFirst(DSHOST); - dsPort = form.getFirst(DSPORT); - baseDN = form.getFirst(BASEDN); - bindDN = form.getFirst(BINDDN); - database = form.getFirst(DATABASE); - secureConn = form.getFirst(SECURECONN); - removeData = form.getFirst(REMOVEDATA); - masterReplicationPort = form.getFirst(MASTER_REPLICATION_PORT); - cloneReplicationPort = form.getFirst(CLONE_REPLICATION_PORT); - replicationSecurity = form.getFirst(REPLICATION_SECURITY); - //TODO - figure out how to get the cert requests - issuingCA = form.getFirst(ISSUING_CA); - backupFile = form.getFirst(BACKUP_FILE); - backupPassword = form.getFirst(BACKUP_PASSWORD); - backupKeys = form.getFirst(BACKUP_KEYS); - adminUID = form.getFirst(ADMIN_UID); - adminEmail = form.getFirst(ADMIN_EMAIL); - adminPassword = form.getFirst(ADMIN_PASSWORD); - adminCertRequest = form.getFirst(ADMIN_CERT_REQUEST); - adminCertRequestType = form.getFirst(ADMIN_CERT_REQUEST_TYPE); - adminSubjectDN = form.getFirst(ADMIN_SUBJECT_DN); - adminName = form.getFirst(ADMIN_NAME); - adminProfileID = form.getFirst(ADMIN_PROFILE_ID); - stepTwo = form.getFirst(STEP_TWO); - } - - - public String getSubsystemName() { - return subsystemName; - } - - public void setSubsystemName(String subsystemName) { - this.subsystemName = subsystemName; - } - - public String getPin() { - return pin; - } - - public void setPin(String pin) { - this.pin = pin; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getSecurityDomainType() { - return securityDomainType; - } - - public void setSecurityDomainType(String securityDomainType) { - this.securityDomainType = securityDomainType; - } - - public String getSecurityDomainUri() { - return securityDomainUri; - } - - public void setSecurityDomainUri(String securityDomainUri) { - this.securityDomainUri = securityDomainUri; - } - - public String getSecurityDomainName() { - return securityDomainName; - } - - public void setSecurityDomainName(String securityDomainName) { - this.securityDomainName = securityDomainName; - } - - public String getSecurityDomainUser() { - return securityDomainUser; - } - - public void setSecurityDomainUser(String securityDomainUser) { - this.securityDomainUser = securityDomainUser; - } - - public String getSecurityDomainPassword() { - return securityDomainPassword; - } - - public void setSecurityDomainPassword(String securityDomainPassword) { - this.securityDomainPassword = securityDomainPassword; - } - - public String getIsClone() { - return isClone; - } - - public void setIsClone(String isClone) { - this.isClone = isClone; - } - - public String getCloneUri() { - return cloneUri; - } - - public void setCloneUri(String cloneUri) { - this.cloneUri = cloneUri; - } - - /** - * @return the p12File - */ - public String getP12File() { - return p12File; - } - - /** - * @param p12File the p12File to set - */ - public void setP12File(String p12File) { - this.p12File = p12File; - } - - /** - * @return the p12Password - */ - public String getP12Password() { - return p12Password; - } - - /** - * @param p12Password the p12Password to set - */ - public void setP12Password(String p12Password) { - this.p12Password = p12Password; - } - - /** - * @return the tokenPassword - */ - public String getTokenPassword() { - return tokenPassword; - } - - /** - * @param tokenPassword the tokenPassword to set - */ - public void setTokenPassword(String tokenPassword) { - this.tokenPassword = tokenPassword; - } - - /** - * @return the hierarchy - */ - public String getHierarchy() { - return hierarchy; - } - - /** - * @param hierarchy the hierarchy to set - */ - public void setHierarchy(String hierarchy) { - this.hierarchy = hierarchy; - } - - /** - * @return the dsHost - */ - public String getDsHost() { - return dsHost; - } - - /** - * @param dsHost the dsHost to set - */ - public void setDsHost(String dsHost) { - this.dsHost = dsHost; - } - - /** - * @return the dsPort - */ - public String getDsPort() { - return dsPort; - } - - /** - * @param dsPort the dsPort to set - */ - public void setDsPort(String dsPort) { - this.dsPort = dsPort; - } - - /** - * @return the baseDN - */ - public String getBaseDN() { - return baseDN; - } - - /** - * @param baseDN the baseDN to set - */ - public void setBaseDN(String baseDN) { - this.baseDN = baseDN; - } - - /** - * @return the bindDN - */ - public String getBindDN() { - return bindDN; - } - - /** - * @param bindDN the bindDN to set - */ - public void setBindDN(String bindDN) { - this.bindDN = bindDN; - } - - /** - * @return the bindpwd - */ - public String getBindpwd() { - return bindpwd; - } - - /** - * @param bindpwd the bindpwd to set - */ - public void setBindpwd(String bindpwd) { - this.bindpwd = bindpwd; - } - - /** - * @return the secureConn - */ - public String getSecureConn() { - return secureConn; - } - - /** - * @param secureConn the secureConn to set - */ - public void setSecureConn(String secureConn) { - this.secureConn = secureConn; - } - - /** - * @return the removeData - */ - public String getRemoveData() { - return removeData; - } - - /** - * @param removeData the removeData to set - */ - public void setRemoveData(String removeData) { - this.removeData = removeData; - } - - /** - * @return the masterReplicationPort - */ - public String getMasterReplicationPort() { - return masterReplicationPort; - } - - /** - * @param masterReplicationPort the masterReplicationPort to set - */ - public void setMasterReplicationPort(String masterReplicationPort) { - this.masterReplicationPort = masterReplicationPort; - } - - /** - * @return the cloneReplicationPort - */ - public String getCloneReplicationPort() { - return cloneReplicationPort; - } - - /** - * @param cloneReplicationPort the cloneReplicationPort to set - */ - public void setCloneReplicationPort(String cloneReplicationPort) { - this.cloneReplicationPort = cloneReplicationPort; - } - - /** - * @return the replicationSecurity - */ - public String getReplicationSecurity() { - return replicationSecurity; - } - - /** - * @param replicationSecurity the replicationSecurity to set - */ - public void setReplicationSecurity(String replicationSecurity) { - this.replicationSecurity = replicationSecurity; - } - - /** - * @return the database - */ - public String getDatabase() { - return database; - } - - /** - * @param database the database to set - */ - public void setDatabase(String database) { - this.database = database; - } - - /** - * - * @return systemCerts - */ - public Collection<SystemCertData> getSystemCerts() { - return systemCerts; - } - - /** - * - * @param systemCerts - */ - public void setSystemCerts(Collection<SystemCertData> systemCerts) { - this.systemCerts = systemCerts; - } - - /** - * @return the issuingCA - */ - public String getIssuingCA() { - return issuingCA; - } - - /** - * @param issuingCA the issuingCA to set - */ - public void setIssuingCA(String issuingCA) { - this.issuingCA = issuingCA; - } - - /** - * @return the backupKeys - */ - public String getBackupKeys() { - return backupKeys; - } - - /** - * @param backupKeys the backupKeys to set - */ - public void setBackupKeys(String backupKeys) { - this.backupKeys = backupKeys; - } - - /** - * @return the backupFile - */ - public String getBackupFile() { - return backupFile; - } - - /** - * @param backupFile the backupFile to set - */ - public void setBackupFile(String backupFile) { - this.backupFile = backupFile; - } - - /** - * @return the backupPassword - */ - public String getBackupPassword() { - return backupPassword; - } - - /** - * @param backupPassword the backupPassword to set - */ - public void setBackupPassword(String backupPassword) { - this.backupPassword = backupPassword; - } - - /** - * @return the adminUID - */ - public String getAdminUID() { - return adminUID; - } - - /** - * @param adminUID the adminUID to set - */ - public void setAdminUID(String adminUID) { - this.adminUID = adminUID; - } - - /** - * @return the adminPassword - */ - public String getAdminPassword() { - return adminPassword; - } - - /** - * @param adminPassword the adminPassword to set - */ - public void setAdminPassword(String adminPassword) { - this.adminPassword = adminPassword; - } - - /** - * @return the adminEmail - */ - public String getAdminEmail() { - return adminEmail; - } - - /** - * @param adminEmail the adminEmail to set - */ - public void setAdminEmail(String adminEmail) { - this.adminEmail = adminEmail; - } - - /** - * @return the adminCertRequest - */ - public String getAdminCertRequest() { - return adminCertRequest; - } - - /** - * @param adminCertRequest the adminCertRequest to set - */ - public void setAdminCertRequest(String adminCertRequest) { - this.adminCertRequest = adminCertRequest; - } - - /** - * @return the adminCertRequestType - */ - public String getAdminCertRequestType() { - return adminCertRequestType; - } - - /** - * @param adminCertRequestType the adminCertRequestType to set - */ - public void setAdminCertRequestType(String adminCertRequestType) { - this.adminCertRequestType = adminCertRequestType; - } - - /** - * @return the adminSubjectDN - */ - public String getAdminSubjectDN() { - return adminSubjectDN; - } - - /** - * @param adminSubjectDN the adminSubjectDN to set - */ - public void setAdminSubjectDN(String adminSubjectDN) { - this.adminSubjectDN = adminSubjectDN; - } - - /** - * @return the adminName - */ - public String getAdminName() { - return adminName; - } - - /** - * @param adminName the adminName to set - */ - public void setAdminName(String adminName) { - this.adminName = adminName; - } - - /** - * @return the adminProfileID - */ - public String getAdminProfileID() { - return adminProfileID; - } - - /** - * @param adminProfileID the adminProfileID to set - */ - public void setAdminProfileID(String adminProfileID) { - this.adminProfileID = adminProfileID; - } - - public String getStepTwo() { - return stepTwo; - } - - public void setStepTwo(String stepTwo) { - this.stepTwo = stepTwo; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java deleted file mode 100644 index 2fcd37d9d..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/ConfigurationResponse.java +++ /dev/null @@ -1,121 +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.cms.servlet.csadmin.model; - -import java.security.cert.CertificateEncodingException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Vector; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; - -import netscape.security.x509.X509CertImpl; - -import com.netscape.certsrv.apps.CMS; -import com.netscape.cms.servlet.csadmin.Cert; - -/** - * @author alee - * - */ -@XmlRootElement(name="ConfigurationResponse") -@XmlAccessorType(XmlAccessType.FIELD) -public class ConfigurationResponse { - - @XmlElementRef - protected Collection<SystemCertData> systemCerts; - - @XmlElement - protected SystemCertData adminCert; - - @XmlElement - protected String status; - - public ConfigurationResponse() { - systemCerts = new ArrayList<SystemCertData>(); - adminCert = new SystemCertData(); - } - - public void setSystemCerts(Vector<Cert> certs) { - systemCerts.clear(); - Enumeration<Cert> e = certs.elements(); - while (e.hasMoreElements()) { - Cert cert = e.nextElement(); - SystemCertData cdata = new SystemCertData(); - cdata.setCert(cert.getCert()); - cdata.setRequest(cert.getRequest()); - cdata.setTag(cert.getCertTag()); - cdata.setCertChain(cert.getCertChain()); - systemCerts.add(cdata); - } - } - - /** - * @return the systemCerts - */ - public Collection<SystemCertData> getSystemCerts() { - return systemCerts; - } - - /** - * @param systemCerts the systemCerts to set - */ - public void setSystemCerts(Collection<SystemCertData> systemCerts) { - this.systemCerts = systemCerts; - } - - /** - * @return the adminCert - */ - public SystemCertData getAdminCert() { - return adminCert; - } - - /** - * @param adminCert the adminCert to set - */ - public void setAdminCert(SystemCertData adminCert) { - this.adminCert = adminCert; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - - - public void setAdminCert(X509CertImpl x509CertImpl) throws CertificateEncodingException { - adminCert.setCert(CMS.BtoA(x509CertImpl.getEncoded())); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/DomainInfo.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/DomainInfo.java deleted file mode 100644 index 7ba351cb1..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/DomainInfo.java +++ /dev/null @@ -1,155 +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.cms.servlet.csadmin.model; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="DomainInfo") -public class DomainInfo { - - @XmlElement(name="CAList") - protected SecurityDomainHostList caList; - - @XmlElement(name="KRAList") - protected SecurityDomainHostList kraList; - - @XmlElement(name="OCSPList") - protected SecurityDomainHostList ocspList; - - @XmlElement(name="TKSList") - protected SecurityDomainHostList tksList; - - @XmlElement(name="TPSList") - protected SecurityDomainHostList tpsList; - - @XmlElement(name="RAList") - protected SecurityDomainHostList raList; - - @XmlElement - protected String name; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the caList - */ - public SecurityDomainHostList getCaList() { - return caList; - } - - /** - * @param caList the caList to set - */ - public void setCaList(SecurityDomainHostList caList) { - this.caList = caList; - } - - /** - * @return the kraList - */ - public SecurityDomainHostList getKraList() { - return kraList; - } - - /** - * @param kraList the kraList to set - */ - public void setKraList(SecurityDomainHostList kraList) { - this.kraList = kraList; - } - - /** - * @return the ocspList - */ - public SecurityDomainHostList getOcspList() { - return ocspList; - } - - /** - * @param ocspList the ocspList to set - */ - public void setOcspList(SecurityDomainHostList ocspList) { - this.ocspList = ocspList; - } - - /** - * @return the tksList - */ - public SecurityDomainHostList getTksList() { - return tksList; - } - - /** - * @param tksList the tksList to set - */ - public void setTksList(SecurityDomainHostList tksList) { - this.tksList = tksList; - } - - /** - * @return the tpsList - */ - public SecurityDomainHostList getTpsList() { - return tpsList; - } - - /** - * @param tpsList the tpsList to set - */ - public void setTpsList(SecurityDomainHostList tpsList) { - this.tpsList = tpsList; - } - - /** - * @return the raList - */ - public SecurityDomainHostList getRaList() { - return raList; - } - - /** - * @param raList the raList to set - */ - public void setRaList(SecurityDomainHostList raList) { - this.raList = raList; - } - - - - - - - -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallToken.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallToken.java deleted file mode 100644 index 59284de37..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallToken.java +++ /dev/null @@ -1,50 +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.cms.servlet.csadmin.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="CertData") -@XmlAccessorType(XmlAccessType.FIELD) -public class InstallToken { - @XmlElement - private String token; - - public InstallToken(String token) { - this.token = token; - } - - public InstallToken() { - // required by jaxb - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallTokenRequest.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallTokenRequest.java deleted file mode 100644 index 40be4179d..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/InstallTokenRequest.java +++ /dev/null @@ -1,99 +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.cms.servlet.csadmin.model; - -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessType; - -/** - * @author alee - * - */ -@XmlRootElement(name="InstallTokenRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class InstallTokenRequest { - @XmlElement - private String user; - - @XmlElement - private String password; - - @XmlElement - private String subsystem; - - @XmlElement - private String host; - - @XmlElement - private String port; - - public InstallTokenRequest(String user, String password, String subsystem, String host, String port) { - this.user = user; - this.password = password; - this.subsystem = subsystem; - this.host = host; - this.port = port; - } - - public InstallTokenRequest() { - // required for jaxb - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSubsystem() { - return subsystem; - } - - public void setSubsystem(String subsystem) { - this.subsystem = subsystem; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHost.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHost.java deleted file mode 100644 index cd12cfaf2..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHost.java +++ /dev/null @@ -1,40 +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.cms.servlet.csadmin.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="DomainInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class SecurityDomainHost { - protected String host; - protected String securePort; - protected String secureAgentPort; - protected String secureAdminPort; - protected String secureEEClientAuthPort; - protected String unSecurePort; - protected String clone; - protected String subsystemName; - protected String domainManager; -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHostList.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHostList.java deleted file mode 100644 index 71922731e..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/SecurityDomainHostList.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - */ -package com.netscape.cms.servlet.csadmin.model; - -import java.util.Collection; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement -public class SecurityDomainHostList { - protected Collection<SecurityDomainHost> systems; - - @XmlElement(name="SubsystemCount") - protected int count; - - /** - * @return the systems - */ - @XmlElementRef - public Collection<SecurityDomainHost> getSystems() { - return systems; - } - - /** - * @param systems the systems to set - */ - public void setSystems(Collection<SecurityDomainHost> systems) { - this.systems = systems; - } - - /** - * @return the count - */ - public int getCount() { - return count; - } - - /** - * @param count the count to set - */ - public void setCount(int count) { - this.count = count; - } - - -} diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java b/base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java deleted file mode 100644 index bd98fe95c..000000000 --- a/base/common/src/com/netscape/cms/servlet/csadmin/model/SystemCertData.java +++ /dev/null @@ -1,270 +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.cms.servlet.csadmin.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="SystemCertData") -@XmlAccessorType(XmlAccessType.FIELD) -public class SystemCertData { - public static final String TAG = "tag"; - public static final String NICKNAME = "nickname"; - public static final String TOKEN = "token"; - public static final String KEY_TYPE = "keyType"; - public static final String KEY_ALGORITHM = "keyAlgorithm"; - public static final String SIGNING_ALGORITHM = "signingAlgorithm"; - public static final String KEY_SIZE = "keySize"; - public static final String KEY_CURVENAME = "keyCurveName"; - public static final String REQUEST = "request"; - public static final String SUBJECT_DN = "subjectDN"; - public static final String CERT = "cert"; - public static final String CERT_CHAIN = "certChain"; - - @XmlElement - protected String tag; - - @XmlElement - protected String nickname; - - @XmlElement - protected String token; - - @XmlElement - protected String keyType; - - @XmlElement - protected String keyAlgorithm; - - @XmlElement - protected String signingAlgorithm; - - @XmlElement - protected String keySize; - - @XmlElement - protected String keyCurveName; - - @XmlElement - protected String request; - - @XmlElement - protected String subjectDN; - - @XmlElement - protected String cert; - - @XmlElement - protected String certChain; - - public SystemCertData() { - // required for JAXB - } - - public SystemCertData(MultivaluedMap<String, String> form) { - tag = form.getFirst(TAG); - nickname = form.getFirst(NICKNAME); - token = form.getFirst(TOKEN); - keyType = form.getFirst(KEY_TYPE); - keyAlgorithm = form.getFirst(KEY_ALGORITHM); - signingAlgorithm = form.getFirst(SIGNING_ALGORITHM); - keySize = form.getFirst(KEY_SIZE); - keyCurveName = form.getFirst(KEY_CURVENAME); - request = form.getFirst(REQUEST); - subjectDN = form.getFirst(SUBJECT_DN); - cert = form.getFirst(CERT); - certChain = form.getFirst(CERT_CHAIN); - } - - /** - * @return the tag - */ - public String getTag() { - return tag; - } - - /** - * @param tag the tag to set - */ - public void setTag(String tag) { - this.tag = tag; - } - - /** - * @return the nickname - */ - public String getNickname() { - return nickname; - } - - /** - * @param nickname the nickname to set - */ - public void setNickname(String nickname) { - this.nickname = nickname; - } - - /** - * @return the token - */ - public String getToken() { - return token; - } - - /** - * @param token the token to set - */ - public void setToken(String token) { - this.token = token; - } - - /** - * @return the keyType - */ - public String getKeyType() { - return keyType; - } - - /** - * @param keyType the keyType to set - */ - public void setKeyType(String keyType) { - this.keyType = keyType; - } - - /** - * @return the keyAlgorithm - */ - public String getKeyAlgorithm() { - return keyAlgorithm; - } - - /** - * @param keyAlgorithm the keyAlgorithm to set - */ - public void setKeyAlgorithm(String keyAlgorithm) { - this.keyAlgorithm = keyAlgorithm; - } - - /** - * @return the signingAlgorithm - */ - public String getSigningAlgorithm() { - return signingAlgorithm; - } - - /** - * @param signingAlgorithm the signingAlgorithm to set - */ - public void setSigningAlgorithm(String signingAlgorithm) { - this.signingAlgorithm = signingAlgorithm; - } - - /** - * @return the keySize - */ - public String getKeySize() { - return keySize; - } - - /** - * @param keySize the keySize to set - */ - public void setKeySize(String keySize) { - this.keySize = keySize; - } - - /** - * @return the keyCurveName - */ - public String getKeyCurveName() { - return keyCurveName; - } - - /** - * @param keyCurveName the keyCurveName to set - */ - public void setKeyCurveName(String keyCurveName) { - this.keyCurveName = keyCurveName; - } - - /** - * @return the request - */ - public String getRequest() { - return request; - } - - /** - * @param request the request to set - */ - public void setRequest(String request) { - this.request = request; - } - - /** - * @return the subjectDN - */ - public String getSubjectDN() { - return subjectDN; - } - - /** - * @param subjectDN the subjectDN to set - */ - public void setSubjectDN(String subjectDN) { - this.subjectDN = subjectDN; - } - - /** - * @return the cert - */ - public String getCert() { - return cert; - } - - /** - * @param cert the cert to set - */ - public void setCert(String cert) { - this.cert = cert; - } - - /** - * @return the certChain - */ - public String getCertChain() { - return certChain; - } - - /** - * @param certChain the certChain to set - */ - public void setCertChain(String certChain) { - this.certChain = certChain; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java b/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java index 2dffac22e..e64bcb2dc 100644 --- a/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java +++ b/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java @@ -32,19 +32,20 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.keydb.IKeyRecord; import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.key.KeyArchivalRequest; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyRequestInfos; +import com.netscape.certsrv.key.KeyRequestResource; +import com.netscape.certsrv.key.KeyResource; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.profile.IEnrollProfile; +import com.netscape.certsrv.request.CMSRequestInfo; +import com.netscape.certsrv.request.CMSRequestInfos; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.servlet.request.CMSRequestDAO; -import com.netscape.cms.servlet.request.KeyRequestResource; -import com.netscape.cms.servlet.request.model.CMSRequestInfo; -import com.netscape.cms.servlet.request.model.CMSRequestInfos; -import com.netscape.cms.servlet.request.model.KeyArchivalRequest; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRequestInfos; /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java b/base/common/src/com/netscape/cms/servlet/key/KeyResource.java deleted file mode 100644 index 948f2ff99..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.netscape.cms.servlet.key; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; - -import com.netscape.cms.servlet.key.model.KeyData; -import com.netscape.cms.servlet.key.model.KeyDataInfos; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; - -@Path("agent/keys") -public interface KeyResource { - - public static final int DEFAULT_MAXTIME = 10; - public static final int DEFAULT_MAXRESULTS = 100; - - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyDataInfos listKeys(@QueryParam("clientID") String clientID, - @QueryParam("status") String status, - @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, - @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); - - - /** - * Used to retrieve a key - * @param data - * @return - */ - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyData retrieveKey(KeyRecoveryRequest data); - - // retrieval - used to test integration with a browser - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public KeyData retrieveKey(MultivaluedMap<String, String> form); -} diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyService.java b/base/common/src/com/netscape/cms/servlet/key/KeyService.java index 965723113..4db2fed0a 100644 --- a/base/common/src/com/netscape/cms/servlet/key/KeyService.java +++ b/base/common/src/com/netscape/cms/servlet/key/KeyService.java @@ -36,17 +36,18 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.keydb.IKeyRecord; import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.key.KeyData; +import com.netscape.certsrv.key.KeyDataInfo; +import com.netscape.certsrv.key.KeyDataInfos; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyResource; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.key.model.KeyData; -import com.netscape.cms.servlet.key.model.KeyDataInfo; -import com.netscape.cms.servlet.key.model.KeyDataInfos; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; import com.netscape.cmsutil.ldap.LDAPUtil; /** diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java deleted file mode 100644 index 2ff2b5d0c..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java +++ /dev/null @@ -1,76 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.key.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="SecurityData") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyData { - @XmlElement - String wrappedPrivateData; - - @XmlElement - String nonceData; - - public KeyData() { - // required for JAXB (defaults) - } - - /** - * @return the wrappedPrivateData - */ - public String getWrappedPrivateData() { - return wrappedPrivateData; - } - - /** - * @param wrappedPrivateData the wrappedPrivateData to set - */ - public void setWrappedPrivateData(String wrappedPrivateData) { - this.wrappedPrivateData = wrappedPrivateData; - } - - /** - * @return the nonceData - */ - - public String getNonceData() { - return nonceData; - } - - /** - * @param nonceData the nonceData to set - */ - - public void setNonceData(String nonceData) { - this.nonceData = nonceData; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java deleted file mode 100644 index 6fd9649fb..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java +++ /dev/null @@ -1,85 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -/** - * - */ -package com.netscape.cms.servlet.key.model; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessorType; - -import com.netscape.certsrv.dbs.keydb.KeyId; - -/** - * @author alee - * - */ -@XmlRootElement(name="SecurityDataInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyDataInfo { - - @XmlElement - protected String keyURL; - - @XmlElement - protected String clientID; - - public KeyDataInfo() { - // required for JAXB (defaults) - } - - /** - * @return the keyURL - */ - public String getKeyURL() { - return keyURL; - } - - /** - * @param keyURL the keyURL to set - */ - public void setKeyURL(String keyURL) { - this.keyURL = keyURL; - } - - /** - * @return the key ID in the keyURL - */ - public KeyId getKeyId() { - String id = keyURL.substring(keyURL.lastIndexOf("/") + 1); - return new KeyId(id); - } - - /** - * @return the clientID - */ - public String getClientID() { - return clientID; - } - - /** - * @param clientID the clientID to set - */ - public void setClientID(String clientID) { - this.clientID = clientID; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java deleted file mode 100644 index 79e5add95..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java +++ /dev/null @@ -1,87 +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.cms.servlet.key.model; - -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import com.netscape.cms.servlet.base.model.Link; - -@XmlRootElement(name = "SecurityDataInfos") -public class KeyDataInfos { - - protected Collection<KeyDataInfo> keyInfos; - protected List<Link> links; - - /** - * @return the keyInfos - */ - @XmlElementRef - public Collection<KeyDataInfo> getKeyInfos() { - return keyInfos; - } - /** - * @param keyInfos the keyInfos to set - */ - public void setKeyInfos(Collection<KeyDataInfo> keyInfos) { - this.keyInfos = keyInfos; - } - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java b/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java index 5ceecd4a5..6c1d92a72 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/PolicyConstraintFactory.java @@ -21,9 +21,9 @@ import java.util.Enumeration; import java.util.Locale; import com.netscape.certsrv.profile.IPolicyConstraint; +import com.netscape.certsrv.profile.PolicyConstraint; +import com.netscape.certsrv.profile.PolicyConstraintValue; import com.netscape.certsrv.property.Descriptor; -import com.netscape.cms.servlet.profile.model.PolicyConstraint; -import com.netscape.cms.servlet.profile.model.PolicyConstraintValue; public class PolicyConstraintFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java b/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java index 01c19936d..fe6b436ab 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/PolicyDefaultFactory.java @@ -22,11 +22,11 @@ import java.util.Locale; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.profile.IPolicyDefault; +import com.netscape.certsrv.profile.PolicyDefault; +import com.netscape.certsrv.profile.ProfileAttribute; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; public class PolicyDefaultFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java index 1e9f4598c..f5a9e7556 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileInputFactory.java @@ -6,8 +6,8 @@ import java.util.Locale; import com.netscape.certsrv.base.IArgBlock; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfileInput; +import com.netscape.certsrv.profile.ProfileInput; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.ProfileInput; public class ProfileInputFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java deleted file mode 100644 index e597f471e..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileNotFoundException.java +++ /dev/null @@ -1,62 +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.cms.servlet.profile; - -import javax.ws.rs.core.Response; - -import com.netscape.cms.servlet.base.PKIException; - -public class ProfileNotFoundException extends PKIException { - - private static final long serialVersionUID = -4784839378360933483L; - - public String profileId; - - public ProfileNotFoundException(String profileId) { - this(profileId, "Profile ID " + profileId + " not found"); - } - - public ProfileNotFoundException(String profileId, String message) { - super(Response.Status.NOT_FOUND, message); - this.profileId = profileId; - } - - public ProfileNotFoundException(String profileId, String message, Throwable cause) { - super(Response.Status.NOT_FOUND, message, cause); - this.profileId = profileId; - } - - public ProfileNotFoundException(Data data) { - super(data); - profileId = data.getAttribute("profileId"); - } - - public Data getData() { - Data data = super.getData(); - data.setAttribute("profileId", profileId); - return data; - } - - public String getProfileId() { - return profileId; - } - - public void setRequestId(String profileId) { - this.profileId = profileId; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java index e15875eff..278acf488 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileOutputFactory.java @@ -22,10 +22,10 @@ import java.util.Locale; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfileOutput; +import com.netscape.certsrv.profile.ProfileAttribute; +import com.netscape.certsrv.profile.ProfileOutput; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.request.IRequest; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfileOutput; public class ProfileOutputFactory { diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java index 56f754874..dcde4b019 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileProcessServlet.java @@ -29,10 +29,13 @@ import com.netscape.certsrv.authentication.EAuthException; import com.netscape.certsrv.authorization.EAuthzException; import com.netscape.certsrv.base.BadRequestDataException; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.profile.EDeferException; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.ERejectException; +import com.netscape.certsrv.profile.ProfileAttribute; +import com.netscape.certsrv.profile.ProfileOutput; import com.netscape.certsrv.property.Descriptor; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.IRequest; @@ -41,9 +44,6 @@ import com.netscape.certsrv.template.ArgSet; import com.netscape.certsrv.template.ArgString; import com.netscape.cms.servlet.cert.RequestProcessor; import com.netscape.cms.servlet.common.CMSRequest; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfileOutput; -import com.netscape.cms.servlet.request.model.CertReviewResponse; /** * This servlet approves profile-based request. diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java deleted file mode 100644 index cc32234b2..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.netscape.cms.servlet.profile; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import com.netscape.cms.servlet.profile.model.ProfileData; -import com.netscape.cms.servlet.profile.model.ProfileDataInfos; - -@Path("agent/profiles") -public interface ProfileResource { - - @GET - @Path("{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileData retrieveProfile(@PathParam("id") String id); - - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileDataInfos listProfiles(); - - /** - * Used to retrieve a key - * - * @param data - * @return - */ - - /* - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public ProfileData retrieveProfile(ProfileRetrievalRequestData request); - - // retrieval - used to test integration with a browser - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public ProfileData retrievProfile(MultivaluedMap<String, String> form); - */ -}
\ No newline at end of file diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java index 0c13b8bba..2b790b8cb 100644 --- a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java +++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java @@ -32,11 +32,13 @@ import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.IProfile; import com.netscape.certsrv.profile.IProfileInput; import com.netscape.certsrv.profile.IProfileSubsystem; +import com.netscape.certsrv.profile.ProfileData; +import com.netscape.certsrv.profile.ProfileDataInfo; +import com.netscape.certsrv.profile.ProfileDataInfos; +import com.netscape.certsrv.profile.ProfileInput; +import com.netscape.certsrv.profile.ProfileNotFoundException; +import com.netscape.certsrv.profile.ProfileResource; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.profile.model.ProfileData; -import com.netscape.cms.servlet.profile.model.ProfileDataInfo; -import com.netscape.cms.servlet.profile.model.ProfileDataInfos; -import com.netscape.cms.servlet.profile.model.ProfileInput; /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java deleted file mode 100644 index 588431a83..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraint.java +++ /dev/null @@ -1,73 +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.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyConstraint { - @XmlAttribute(name="id") - private String name; - - @XmlElement(name="description") - private String text; - - @XmlElement(name = "constraint") - private List<PolicyConstraintValue> constraints = new ArrayList<PolicyConstraintValue>(); - - public PolicyConstraint() { - // required for jaxb - } - - public void addConstraint(PolicyConstraintValue constraint) { - constraints.add(constraint); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public List<PolicyConstraintValue> getConstraints() { - return constraints; - } - - public void setConstraints(List<PolicyConstraintValue> constraints) { - this.constraints = constraints; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java deleted file mode 100644 index 7b60e7ea6..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyConstraintValue.java +++ /dev/null @@ -1,61 +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.cms.servlet.profile.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.property.Descriptor; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyConstraintValue { - @XmlAttribute(name="id") - private String name; - - @XmlElement - private Descriptor descriptor; - - public PolicyConstraintValue() { - // required for jax-b - } - - public PolicyConstraintValue(String name, Descriptor descriptor) { - this.name = name; - this.descriptor = descriptor; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Descriptor getDescriptor() { - return descriptor; - } - - public void setDescriptor(Descriptor descriptor) { - this.descriptor = descriptor; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java b/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java deleted file mode 100644 index 2c66fc9dc..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/PolicyDefault.java +++ /dev/null @@ -1,73 +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.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class PolicyDefault { - @XmlAttribute(name="id") - private String name; - - @XmlElement(name="description") - private String text; - - @XmlElement(name="policyAttribute") - private List<ProfileAttribute> attributes = new ArrayList<ProfileAttribute>(); - - public PolicyDefault() { - // required for jaxb - } - - public void addAttribute(ProfileAttribute attr) { - attributes.add(attr); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public List<ProfileAttribute> getAttributes() { - return attributes; - } - - public void setAttributes(List<ProfileAttribute> attributes) { - this.attributes = attributes; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java deleted file mode 100644 index 616c0695d..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileAttribute.java +++ /dev/null @@ -1,80 +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.cms.servlet.profile.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.property.Descriptor; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileAttribute { - - @XmlAttribute - private String name; - - @XmlElement - private String value; - - @XmlElement - private Descriptor descriptor; - - public ProfileAttribute() { - // required for jax-b - } - - public ProfileAttribute(String name, String value, Descriptor descriptor) { - this.name = name; - this.value = value; - this.descriptor = descriptor; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public Descriptor getDescriptor() { - return descriptor; - } - - public void setDescriptor(Descriptor descriptor) { - this.descriptor = descriptor; - } - - @Override - public String toString() { - return "PolicyAttribute [name=" + name + ", value=" + value + ", descriptor=" + descriptor + "]"; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java deleted file mode 100644 index 7f7f26b29..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileData.java +++ /dev/null @@ -1,147 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author jmagne - * - */ - -@XmlRootElement(name = "ProfileData") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileData { - - @XmlElement - protected String id; - - @XmlElement - protected String name; - - @XmlElement - protected String description; - - @XmlElement - protected boolean isEnabled; - - @XmlElement - protected boolean isVisible; - - @XmlElement - protected String enabledBy; - - @XmlElement(name = "Input") - protected List<ProfileInput> inputs = new ArrayList<ProfileInput>(); - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public void setIsEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - } - - public boolean getIsEnabled() { - return isEnabled; - } - - public void setIsVisible(boolean isVisible) { - this.isVisible = isVisible; - } - - public boolean getIsVisible() { - return isVisible; - } - - public void setEnabledBy(String enabledBy) { - this.enabledBy = enabledBy; - } - - public String getEnabledBy() { - return enabledBy; - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - public ProfileInput addProfileInput(String name) { - - ProfileInput oldInput = getProfileInput(name); - - if (oldInput != null) - return oldInput; - - ProfileInput newInput = new ProfileInput(); - newInput.setInputId(name); - - inputs.add(newInput); - - return newInput; - } - - public ProfileInput getProfileInput(String name) { - - ProfileInput input = null; - - Iterator<ProfileInput> it = inputs.iterator(); - - ProfileInput curInput = null; - while (it.hasNext()) { - curInput = it.next(); - - if (curInput != null && curInput.getInputId().equals(name)) - break; - } - - return input; - } - - public List<ProfileInput> getProfileInputsList() { - return inputs; - } - -}
\ No newline at end of file diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java deleted file mode 100644 index d5083c7a4..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfo.java +++ /dev/null @@ -1,68 +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) 2011 Red Hat, Inc. -//All rights reserved. -//--- END COPYRIGHT BLOCK --- - -package com.netscape.cms.servlet.profile.model; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name = "ProfileDataInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileDataInfo { - - @XmlElement - protected String profileURL; - - @XmlElement - protected String profileId; - - public ProfileDataInfo() { - // required for JAXB (defaults) - } - - /** - * @return the profileURL - */ - public String getProfileURL() { - return profileURL; - } - - /** - * @param keyURL the profileURL to set - */ - public void setProfileURL(String profileURL) { - this.profileURL = profileURL; - } - - public void setProfileId(String profileId) { - this.profileId = profileId; - } - - /** - * @return the profile ID in the profileURL - */ - public String getProfileId() { - return profileId; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java deleted file mode 100644 index e14ac6641..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileDataInfos.java +++ /dev/null @@ -1,90 +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.cms.servlet.profile.model; - -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import com.netscape.cms.servlet.base.model.Link; - -@XmlRootElement(name = "ProfileDataInfos") -public class ProfileDataInfos { - - protected Collection<ProfileDataInfo> profileInfos; - protected List<Link> links; - - /** - * @return the ProfileInfos - */ - @XmlElementRef - public Collection<ProfileDataInfo> getProfileInfos() { - return profileInfos; - } - - /** - * @param ProfileInfos theProfileInfos to set - */ - public void setProfileInfos(Collection<ProfileDataInfo> profileInfos) { - this.profileInfos = profileInfos; - } - - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java deleted file mode 100644 index 631a013cc..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileInput.java +++ /dev/null @@ -1,94 +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.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -public class ProfileInput { - - public ProfileInput() { - // required for jaxb - } - - @XmlElement - public String getInputId() { - return inputId; - } - - private String inputId; - - @XmlJavaTypeAdapter(InputAttrsAdapter.class) - public Map<String, String> InputAttrs = new LinkedHashMap<String, String>(); - - public void setInputAttr(String name, String value) { - InputAttrs.put(name, value); - } - - public void setInputId(String inputId) { - this.inputId = inputId; - } - - public static class InputAttrsAdapter extends XmlAdapter<InputAttrList, Map<String, String>> { - - public InputAttrList marshal(Map<String, String> map) { - InputAttrList list = new InputAttrList(); - for (Map.Entry<String, String> entry : map.entrySet()) { - Attribute attribute = new Attribute(); - attribute.name = entry.getKey(); - attribute.value = entry.getValue(); - list.attributes.add(attribute); - } - return list; - } - - public Map<String, String> unmarshal(InputAttrList list) { - Map<String, String> map = new LinkedHashMap<String, String>(); - for (Attribute attribute : list.attributes) { - map.put(attribute.name, attribute.value); - } - return map; - } - } - - public static class InputAttrList { - @XmlElement(name = "InputAttr") - public List<Attribute> attributes = new ArrayList<Attribute>(); - } - - public static class Attribute { - - @XmlAttribute - public String name; - - @XmlValue - public String value; - } - - public Map<String, String> getAttributes() { - return InputAttrs; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java deleted file mode 100644 index f27db4101..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfileOutput.java +++ /dev/null @@ -1,84 +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.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileOutput { - - public ProfileOutput() { - // required for jaxb - } - - @XmlElement - private String outputId; - - @XmlElement(name = "attributes") - private List<ProfileAttribute> attrs = new ArrayList<ProfileAttribute>(); - - @XmlElement - private String name; - - @XmlElement - private String text; - - public String getOutputId() { - return outputId; - } - - public void setOutputId(String OutputId) { - this.outputId = OutputId; - } - - public List<ProfileAttribute> getAttrs() { - return attrs; - } - - public void setAttrs(List<ProfileAttribute> attrs) { - this.attrs = attrs; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public void addAttribute(ProfileAttribute attr) { - attrs.add(attr); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java deleted file mode 100644 index a24f93619..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicy.java +++ /dev/null @@ -1,82 +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.cms.servlet.profile.model; - -import java.io.ByteArrayOutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfilePolicy { - @XmlAttribute - private String id = null; - - @XmlElement - private PolicyDefault def = null; - - @XmlElement - private PolicyConstraint constraint = null; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public PolicyDefault getDef() { - return def; - } - - public void setDef(PolicyDefault def) { - this.def = def; - } - - public PolicyConstraint getConstraint() { - return constraint; - } - - public void setConstraint(PolicyConstraint constraint) { - this.constraint = constraint; - } - - public String toString() { - try { - JAXBContext context = JAXBContext.newInstance(ProfilePolicy.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - marshaller.marshal(this, stream); - return stream.toString(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java b/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java deleted file mode 100644 index 784f5670d..000000000 --- a/base/common/src/com/netscape/cms/servlet/profile/model/ProfilePolicySet.java +++ /dev/null @@ -1,50 +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.cms.servlet.profile.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfilePolicySet { - @XmlElement - protected List<ProfilePolicy> policies = new ArrayList<ProfilePolicy>(); - - public List<ProfilePolicy> getPolicies() { - return policies; - } - - public void setPolicies(List<ProfilePolicy> policies) { - this.policies = policies; - } - - public void addPolicy(ProfilePolicy policy) { - policies.add(policy); - } - - public void removePolicy(ProfilePolicy policy) { - policies.remove(policy); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/CMSRequestDAO.java b/base/common/src/com/netscape/cms/servlet/request/CMSRequestDAO.java index 5d1df774d..f7c9f7aae 100644 --- a/base/common/src/com/netscape/cms/servlet/request/CMSRequestDAO.java +++ b/base/common/src/com/netscape/cms/servlet/request/CMSRequestDAO.java @@ -28,14 +28,14 @@ import javax.ws.rs.core.UriInfo; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authority.IAuthority; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.Link; +import com.netscape.certsrv.request.CMSRequestInfo; +import com.netscape.certsrv.request.CMSRequestInfos; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestList; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.IRequestVirtualList; import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.base.model.Link; -import com.netscape.cms.servlet.request.model.CMSRequestInfo; -import com.netscape.cms.servlet.request.model.CMSRequestInfos; /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java deleted file mode 100644 index 8a6d1b182..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java +++ /dev/null @@ -1,118 +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.cms.servlet.request; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.request.model.CertReviewResponse; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; - -@Path("") -public interface CertRequestResource { - - public static final int DEFAULT_START = 0; - public static final int DEFAULT_PAGESIZE = 20; - public static final int DEFAULT_MAXRESULTS = 100; - public static final int DEFAULT_MAXTIME = 10; - - /** - * Used to generate list of cert requests based on the search parameters - */ - @GET - @Path("agent/certrequests") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfos listRequests(@QueryParam("requestState") String requestState, - @QueryParam("requestType") String requestType, - @DefaultValue("" + DEFAULT_START) @QueryParam("start") RequestId start, - @DefaultValue("" + DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize, - @DefaultValue("" + DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, - @DefaultValue("" + DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); - - /** - * Used to retrieve cert request info for a specific request - */ - @GET - @Path("certrequests/{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfo getRequestInfo(@PathParam("id") RequestId id); - - @GET - @Path("agent/certrequests/{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertReviewResponse reviewRequest(@PathParam("id") RequestId id); - - // Enrollment - used to test integration with a browser - @POST - @Path("certrequests") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public CertRequestInfos enrollCert(MultivaluedMap<String, String> form); - - @POST - @Path("certrequests") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public CertRequestInfos enrollCert(CertEnrollmentRequest data); - - @POST - @Path("agent/certrequests/{id}/approve") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void approveRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/reject") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void rejectRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/cancel") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void cancelRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/update") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void updateRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/validate") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void validateRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/unassign") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void unassignRequest(@PathParam("id") RequestId id, CertReviewResponse data); - - @POST - @Path("agent/certrequests/{id}/assign") - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public void assignRequest(@PathParam("id") RequestId id, CertReviewResponse data); -} diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestService.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestService.java index 174b6d7fb..a8099003f 100644 --- a/base/common/src/com/netscape/cms/servlet/request/CertRequestService.java +++ b/base/common/src/com/netscape/cms/servlet/request/CertRequestService.java @@ -26,20 +26,22 @@ import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.authentication.EAuthException; import com.netscape.certsrv.authorization.EAuthzException; import com.netscape.certsrv.base.BadRequestDataException; +import com.netscape.certsrv.base.BadRequestException; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.cert.CertEnrollmentRequest; +import com.netscape.certsrv.cert.CertRequestInfo; +import com.netscape.certsrv.cert.CertRequestInfos; +import com.netscape.certsrv.cert.CertRequestResource; +import com.netscape.certsrv.cert.CertReviewResponse; import com.netscape.certsrv.profile.EDeferException; import com.netscape.certsrv.profile.EProfileException; import com.netscape.certsrv.profile.ERejectException; import com.netscape.certsrv.property.EPropertyException; import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.base.BadRequestException; -import com.netscape.cms.servlet.base.PKIException; +import com.netscape.certsrv.request.RequestNotFoundException; import com.netscape.cms.servlet.base.PKIService; import com.netscape.cms.servlet.cert.CertRequestDAO; -import com.netscape.cms.servlet.request.model.CertEnrollmentRequest; -import com.netscape.cms.servlet.request.model.CertRequestInfo; -import com.netscape.cms.servlet.request.model.CertRequestInfos; -import com.netscape.cms.servlet.request.model.CertReviewResponse; import com.netscape.cmsutil.ldap.LDAPUtil; /** diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java deleted file mode 100644 index d583d9580..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.netscape.cms.servlet.request; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.request.model.KeyArchivalRequest; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRequestInfos; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; - -@Path("agent/keyrequests") -public interface KeyRequestResource { - - public final String SYMMETRIC_KEY_TYPE = "symmetricKey"; - public final String PASS_PHRASE_TYPE = "passPhrase"; - public final String ASYMMETRIC_KEY_TYPE = "asymmetricKey"; - - public static final int DEFAULT_START = 0; - public static final int DEFAULT_PAGESIZE = 20; - public static final int DEFAULT_MAXRESULTS = 100; - public static final int DEFAULT_MAXTIME = 10; - - /** - * Used to generate list of key requests based on the search parameters - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfos listRequests(@QueryParam("requestState") String requestState, - @QueryParam("requestType") String requestType, - @QueryParam("clientID") String clientID, - @DefaultValue(""+DEFAULT_START) @QueryParam("start") RequestId start, - @DefaultValue(""+DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize, - @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, - @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); - - - /** - * Used to retrieve key request info for a specific request - */ - @GET - @Path("{id}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo getRequestInfo(@PathParam("id") RequestId id); - - // Archiving - used to test integration with a browser - @POST - @Path("archive") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED}) - public KeyRequestInfo archiveKey(MultivaluedMap<String, String> form); - - @POST - @Path("archive") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo archiveKey(KeyArchivalRequest data); - - //Recovery - used to test integration with a browser - @POST - @Path("recover") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED}) - public KeyRequestInfo recoverKey(MultivaluedMap<String, String> form); - - @POST - @Path("recover") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo recoverKey(KeyRecoveryRequest data); - - @POST - @Path("{id}/approve") - public void approveRequest(@PathParam("id") RequestId id); - - @POST - @Path("{id}/reject") - public void rejectRequest(@PathParam("id") RequestId id); - - @POST - @Path("{id}/cancel") - public void cancelRequest(@PathParam("id") RequestId id); - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestService.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestService.java index 188bcb23c..775c0ed28 100644 --- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestService.java +++ b/base/common/src/com/netscape/cms/servlet/request/KeyRequestService.java @@ -24,14 +24,16 @@ import javax.ws.rs.core.Response; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.base.PKIException; +import com.netscape.certsrv.key.KeyArchivalRequest; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyRequestInfos; +import com.netscape.certsrv.key.KeyRequestResource; import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.base.PKIException; +import com.netscape.certsrv.request.RequestNotFoundException; import com.netscape.cms.servlet.base.PKIService; import com.netscape.cms.servlet.key.KeyRequestDAO; -import com.netscape.cms.servlet.request.model.KeyArchivalRequest; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRequestInfos; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; import com.netscape.cmsutil.ldap.LDAPUtil; /** diff --git a/base/common/src/com/netscape/cms/servlet/request/RequestNotFoundException.java b/base/common/src/com/netscape/cms/servlet/request/RequestNotFoundException.java deleted file mode 100644 index 6bef885f9..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/RequestNotFoundException.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.netscape.cms.servlet.request; - -import javax.ws.rs.core.Response; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.cms.servlet.base.PKIException; - -public class RequestNotFoundException extends PKIException { - - private static final long serialVersionUID = -4784839378360933483L; - - public RequestId requestId; - - public RequestNotFoundException(RequestId requestId) { - this(requestId, "Request ID "+requestId.toHexString()+" not found"); - } - - public RequestNotFoundException(RequestId requestId, String message) { - super(Response.Status.NOT_FOUND, message); - this.requestId = requestId; - } - - public RequestNotFoundException(RequestId requestId, String message, Throwable cause) { - super(Response.Status.NOT_FOUND, message, cause); - this.requestId = requestId; - } - - public RequestNotFoundException(Data data) { - super(data); - requestId = new RequestId(data.getAttribute("requestId")); - } - - public Data getData() { - Data data = super.getData(); - data.setAttribute("requestId", requestId.toString()); - return data; - } - - public RequestId getRequestId() { - return requestId; - } - - public void setRequestId(RequestId requestId) { - this.requestId = requestId; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java deleted file mode 100644 index f06334f6b..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfo.java +++ /dev/null @@ -1,91 +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.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestStatus; -import com.netscape.certsrv.request.RequestStatusAdapter; -@XmlAccessorType(XmlAccessType.FIELD) -public class CMSRequestInfo { - - @XmlElement - protected String requestType; - - @XmlElement - @XmlJavaTypeAdapter(RequestStatusAdapter.class) - protected RequestStatus requestStatus; - - @XmlElement - protected String requestURL; - - /** - * @return the requestType - */ - public String getRequestType() { - return requestType; - } - - /** - * @param requestType the requestType to set - */ - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - /** - * @return the requestStatus - */ - public RequestStatus getRequestStatus() { - return requestStatus; - } - - /** - * @param requestStatus the requestStatus to set - */ - public void setRequestStatus(RequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - /** - * @return the requestURL - */ - public String getRequestURL() { - return requestURL; - } - - /** - * @return the request ID in the requestURL - */ - public RequestId getRequestId() { - String id = requestURL.substring(requestURL.lastIndexOf("/") + 1); - return new RequestId(id); - } - - /** - * @param requestURL the requestURL to set - */ - public void setRequestURL(String requestURL) { - this.requestURL = requestURL; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java deleted file mode 100644 index 63b2e56b1..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CMSRequestInfos.java +++ /dev/null @@ -1,59 +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) 2011 Red Hat, Inc. -//All rights reserved. -//--- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.request.model; - -import java.util.Collection; -import java.util.List; - -import com.netscape.cms.servlet.base.model.Link; - -//Convenience class to simply hold a Collection of CMSRequests and a List of Links. -public class CMSRequestInfos { - - protected Collection<CMSRequestInfo> requests; - protected List<Link> links; - - /** - * @return the requests - */ - public Collection<CMSRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<CMSRequestInfo> requests) { - this.requests = requests; - } - - /** - * @return the links - */ - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java deleted file mode 100644 index a249d657d..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertEnrollmentRequest.java +++ /dev/null @@ -1,321 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.request.model; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.cms.servlet.profile.model.ProfileInput; -import com.netscape.cms.servlet.profile.model.ProfileOutput; - -/** - * @author jmagne - * - */ - -@XmlRootElement(name = "CertEnrollmentRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertEnrollmentRequest { - - private static final String PROFILE_ID = "profileId"; - private static final String RENEWAL = "renewal"; - private static final String SERIAL_NUM = "serial_num"; - - @XmlElement - protected String profileId; - - @XmlElement - protected boolean isRenewal; - - @XmlElement - protected String serialNum; // used for one type of renewal - - @XmlElement - protected String remoteHost; - - @XmlElement - protected String remoteAddr; - - @XmlElement(name = "Input") - protected List<ProfileInput> inputs = new ArrayList<ProfileInput>(); - - @XmlElement(name = "Output") - protected List<ProfileOutput> outputs = new ArrayList<ProfileOutput>(); - - public CertEnrollmentRequest() { - // required for jaxb - } - - public CertEnrollmentRequest(MultivaluedMap<String, String> form) { - profileId = form.getFirst(PROFILE_ID); - String renewalStr = form.getFirst(RENEWAL); - serialNum = form.getFirst(SERIAL_NUM); - isRenewal = new Boolean(renewalStr); - } - - /** - * @return the profileId - */ - public String getProfileId() { - return profileId; - } - - /** - * @param profileId the profileId to set - */ - - public void setProfileId(String profileId) { - this.profileId = profileId; - } - - /** - * @return renewal - */ - - public boolean getIsRenewal() { - return isRenewal; - } - - public void addInput(ProfileInput input) { - ProfileInput curInput = getInput(input.getInputId()); - if (curInput != null) { - getInputs().remove(curInput); - } - getInputs().add(input); - } - - public void deleteInput(ProfileInput input) { - ProfileInput curInput = getInput(input.getInputId()); - if (curInput != null) { - getInputs().remove(curInput); - } - } - - public ProfileInput createInput(String name) { - - ProfileInput oldInput = getInput(name); - - if (oldInput != null) - return oldInput; - - ProfileInput newInput = new ProfileInput(); - newInput.setInputId(name); - - getInputs().add(newInput); - - return newInput; - } - - public ProfileInput getInput(String name) { - - ProfileInput input = null; - - Iterator<ProfileInput> it = getInputs().iterator(); - - ProfileInput curInput = null; - while (it.hasNext()) { - curInput = it.next(); - if (curInput != null && curInput.getInputId().equals(name)) - break; - } - - return input; - } - - public void addOutput(ProfileOutput output) { - ProfileOutput curOutput = getOutput(output.getOutputId()); - if (curOutput != null) { - getOutputs().remove(curOutput); - } - getOutputs().add(output); - } - - public void deleteOutput(ProfileOutput output) { - ProfileOutput curOutput = getOutput(output.getOutputId()); - if (curOutput != null) { - getInputs().remove(curOutput); - } - } - - public ProfileOutput getOutput(String name) { - ProfileOutput output = null; - ProfileOutput curOutput = null; - - Iterator<ProfileOutput> it = getOutputs().iterator(); - while (it.hasNext()) { - curOutput = it.next(); - if (curOutput != null && curOutput.getOutputId().equals(name)) - break; - } - - return output; - } - - /** - * @param renewal the renewal to set - */ - public void setIsRenewal(boolean isRenewal) { - this.isRenewal = isRenewal; - } - - public HashMap<String, String> toParams() { - HashMap<String, String> ret = new HashMap<String, String>(); - ret.put("isRenewal", Boolean.valueOf(isRenewal).toString()); - if (profileId != null) ret.put(PROFILE_ID, profileId); - if (serialNum != null) ret.put(SERIAL_NUM, serialNum); - if (remoteHost != null) ret.put("remoteHost", remoteHost); - if (remoteAddr != null) ret.put("remoteAddr", remoteAddr); - - for (ProfileInput input: inputs) { - Map<String, String> attrs = input.getAttributes(); - for (Map.Entry<String, String> entry: attrs.entrySet()) { - ret.put(entry.getKey(), entry.getValue()); - } - } - - return ret; - } - - public static void main(String args[]) throws Exception { - CertEnrollmentRequest data = new CertEnrollmentRequest(); - data.setProfileId("caUserCert"); - data.setIsRenewal(false); - - //Simulate a "caUserCert" Profile enrollment - - ProfileInput certReq = data.createInput("KeyGenInput"); - certReq.setInputAttr("cert_request_type", "crmf"); - certReq.setInputAttr( - "cert_request", - "MIIBozCCAZ8wggEFAgQBMQp8MIHHgAECpQ4wDDEKMAgGA1UEAxMBeKaBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2NgaPHp0jiohcP4M+ufrJOZEqH8GV+liu5JLbT8nWpkfhC+8EUBqT6g+n3qroSxIcNVGNdcsBEqs1utvpItzyslAbpdyat3WwQep1dWMzo6RHrPDuIoxNA0Yka1n3qEX4U//08cLQtUv2bYglYgN/hOCNQemLV6vZWAv0n7zelkCAwEAAakQMA4GA1UdDwEB/wQEAwIF4DAzMBUGCSsGAQUFBwUBAQwIcmVnVG9rZW4wGgYJKwYBBQUHBQECDA1hdXRoZW50aWNhdG9yoYGTMA0GCSqGSIb3DQEBBQUAA4GBAJ1VOQcaSEhdHa94s8kifVbSZ2WZeYE5//qxL6wVlEst20vq4ybj13CetnbN3+WT49Zkwp7Fg+6lALKgSk47suTg3EbbQDm+8yOrC0nc/q4PTRoHl0alMmUxIhirYc1t3xoCMqJewmjX1bNP8lpVIZAYFZo4eZCpZaiSkM5BeHhz"); - - ProfileInput subjectName = data.createInput("SubjectNameInput"); - subjectName.setInputAttr("sn_uid", "jmagne"); - subjectName.setInputAttr("sn_e", "jmagne@redhat.com"); - subjectName.setInputAttr("sn_c", "US"); - subjectName.setInputAttr("sn_ou", "Development"); - subjectName.setInputAttr("sn_ou1", "IPA"); - subjectName.setInputAttr("sn_ou2", "Dogtag"); - subjectName.setInputAttr("sn_ou3", "CA"); - subjectName.setInputAttr("sn_cn", "Common"); - subjectName.setInputAttr("sn_o", "RedHat"); - - ProfileInput submitter = data.createInput("SubmitterInfoInput"); - submitter.setInputAttr("requestor_name", "admin"); - submitter.setInputAttr("requestor_email", "admin@redhat.com"); - submitter.setInputAttr("requestor_phone", "650-555-5555"); - - try { - JAXBContext context = JAXBContext.newInstance(CertEnrollmentRequest.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - marshaller.marshal(data, stream); - - System.out.println("Originally marshalled enrollment object. \n"); - - System.out.println(stream.toString()); - - //Try to unmarshall - - Unmarshaller unmarshaller = context.createUnmarshaller(); - - ByteArrayInputStream bais = new ByteArrayInputStream(stream.toByteArray()); - Object unmarshalled = unmarshaller.unmarshal(bais); - - //Try re-marshalling, unmarshalled object to compare - - stream.reset(); - - marshaller.marshal(unmarshalled, stream); - - System.out.println("Remarshalled unmarshalled enrollment object. \n"); - - System.out.println(stream.toString()); - - } catch (JAXBException e) { - System.out.println(e.toString()); - } - } - - public String getSerialNum() { - return serialNum; - } - - public void setSerialNum(String serialNum) { - this.serialNum = serialNum; - } - - public List<ProfileInput> getInputs() { - return inputs; - } - - public void setInputs(List<ProfileInput> inputs) { - this.inputs = inputs; - } - - public String getRemoteAddr() { - return remoteAddr; - } - - public void setRemoteAddr(String remoteAddr) { - this.remoteAddr = remoteAddr; - } - - public String getRemoteHost() { - return remoteHost; - } - - public void setRemoteHost(String remoteHost) { - this.remoteHost = remoteHost; - } - - public List<ProfileOutput> getOutputs() { - return outputs; - } - - public void setOutputs(List<ProfileOutput> outputs) { - this.outputs = outputs; - } - - public void setRenewal(boolean isRenewal) { - this.isRenewal = isRenewal; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java deleted file mode 100644 index 0754fe547..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfo.java +++ /dev/null @@ -1,84 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -package com.netscape.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.dbs.certdb.CertId; - -@XmlRootElement(name = "CertRequestInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertRequestInfo extends CMSRequestInfo { - - public static final String REQ_COMPLETE = "complete"; - - @XmlElement - protected String certURL; - - @XmlElement - protected String certRequestType; - - public CertRequestInfo() { - // required to be here for JAXB (defaults) - } - - /** - * @param certRequestType to set - */ - - public void setCertRequestType(String certRequestType) { - this.certRequestType = certRequestType; - } - - /** - * @return the certRequestType - */ - - public String getCertRequestType() { - return certRequestType; - } - - /** - * @set the certURL - */ - public void setCertURL(String certURL) { - this.certURL = certURL; - } - - /** - * @return the certURL - */ - public String getCertURL() { - return certURL; - } - - /** - * @return the certId - */ - - public CertId getCertId() { - if (certURL == null) return null; - String id = certURL.substring(certURL.lastIndexOf("/") + 1); - return new CertId(id); - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java deleted file mode 100644 index a4c39a33e..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRequestInfos.java +++ /dev/null @@ -1,89 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.request.model; - -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import com.netscape.cms.servlet.base.model.Link; - -@XmlRootElement(name = "CertRequestInfos") -public class CertRequestInfos { - protected Collection<CertRequestInfo> requests; - protected List<Link> links; - - /** - * @return the requests - */ - @XmlElementRef - public Collection<CertRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<CertRequestInfo> requests) { - this.requests = requests; - } - - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java deleted file mode 100644 index 9b8caacd9..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertRetrievalRequest.java +++ /dev/null @@ -1,78 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.dbs.certdb.CertId; -import com.netscape.certsrv.dbs.certdb.CertIdAdapter; -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name = "CertRetrievalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class CertRetrievalRequest { - - private static final String CERT_ID = "certId"; - - @XmlElement - @XmlJavaTypeAdapter(CertIdAdapter.class) - protected CertId certId; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - public CertRetrievalRequest() { - // required for JAXB (defaults) - } - - public CertRetrievalRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(CERT_ID)) { - certId = new CertId(form.getFirst(CERT_ID)); - } - } - - /** - * @return the CertId - */ - public CertId getCertId() { - return certId; - } - - /** - * @param CertId the CertId to set - */ - public void setCertId(CertId certId) { - this.certId = certId; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java b/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java deleted file mode 100644 index 3bec6bada..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/CertReviewResponse.java +++ /dev/null @@ -1,252 +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.cms.servlet.request.model; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -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; -import com.netscape.cms.servlet.profile.model.PolicyDefault; -import com.netscape.cms.servlet.profile.model.ProfileAttribute; -import com.netscape.cms.servlet.profile.model.ProfilePolicy; -import com.netscape.cms.servlet.profile.model.ProfilePolicySet; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -public class CertReviewResponse extends CertEnrollmentRequest { - - @XmlElement(name="ProfilePolicySet") - protected List<ProfilePolicySet> policySets = new ArrayList<ProfilePolicySet>(); - - protected String nonce; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - protected String requestType; - - protected String requestStatus; - - protected String requestOwner; - - protected String requestCreationTime; - - protected String requestModificationTime; - - protected String requestNotes; - - protected String profileApprovedBy; - - protected String profileSetId; - - protected String profileIsVisible; - - protected String profileName; - - protected String profileDescription; - - protected String profileRemoteHost; - - protected String profileRemoteAddr; - - public String getNonce() { - return nonce; - } - - public void setNonce(String nonce) { - this.nonce = nonce; - } - - public RequestId getRequestId() { - return requestId; - } - - public void setRequestId(RequestId requestId) { - this.requestId = requestId; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public String getRequestStatus() { - return requestStatus; - } - - public void setRequestStatus(String requestStatus) { - this.requestStatus = requestStatus; - } - - public String getRequestOwner() { - return requestOwner; - } - - public void setRequestOwner(String requestOwner) { - this.requestOwner = requestOwner; - } - - public String getRequestCreationTime() { - return requestCreationTime; - } - - public void setRequestCreationTime(String requestCreationTime) { - this.requestCreationTime = requestCreationTime; - } - - public String getRequestModificationTime() { - return requestModificationTime; - } - - public void setRequestModificationTime(String requestModificationTime) { - this.requestModificationTime = requestModificationTime; - } - - public String getRequestNotes() { - return requestNotes; - } - - public void setRequestNotes(String requestNotes) { - this.requestNotes = requestNotes; - } - - public String getProfileApprovedBy() { - return profileApprovedBy; - } - - public void setProfileApprovedBy(String profileApprovedBy) { - this.profileApprovedBy = profileApprovedBy; - } - - public String getProfileSetId() { - return profileSetId; - } - - public void setProfileSetId(String profileSetId) { - this.profileSetId = profileSetId; - } - - public String getProfileIsVisible() { - return profileIsVisible; - } - - public void setProfileIsVisible(String profileIsVisible) { - this.profileIsVisible = profileIsVisible; - } - - public String getProfileName() { - return profileName; - } - - public void setProfileName(String profileName) { - this.profileName = profileName; - } - - public String getProfileDescription() { - return profileDescription; - } - - public void setProfileDescription(String profileDescription) { - this.profileDescription = profileDescription; - } - - public String getProfileRemoteHost() { - return profileRemoteHost; - } - - public void setProfileRemoteHost(String profileRemoteHost) { - this.profileRemoteHost = profileRemoteHost; - } - - public String getProfileRemoteAddr() { - return profileRemoteAddr; - } - - public void setProfileRemoteAddr(String profileRemoteAddr) { - this.profileRemoteAddr = profileRemoteAddr; - } - - public String toString() { - try { - JAXBContext context = JAXBContext.newInstance(CertReviewResponse.class); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - marshaller.marshal(this, stream); - return stream.toString(); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public List<ProfilePolicySet> getPolicySets() { - return policySets; - } - - public void setPolicySets(List<ProfilePolicySet> policySets) { - this.policySets = policySets; - } - - public void addProfilePolicySet(ProfilePolicySet policySet) { - policySets.add(policySet); - } - - public void removeProfilePolicySet(ProfilePolicySet policySet) { - policySets.remove(policySet); - } - - @Override - public HashMap<String,String> toParams() { - HashMap<String,String> ret = super.toParams(); - - if (requestId != null) ret.put("requestId", requestId.toString()); - if (requestNotes != null) ret.put("requestNotes", requestNotes); - if (nonce != null) ret.put("nonces", nonce); - if (requestType != null) ret.put("requestType", requestType); - - for (ProfilePolicySet policySet: policySets) { - for (ProfilePolicy policy: policySet.getPolicies()) { - PolicyDefault def = policy.getDef(); - List<ProfileAttribute> attrs = def.getAttributes(); - for (ProfileAttribute attr: attrs) { - ret.put(attr.getName(), attr.getValue()); - } - } - } - return ret; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java deleted file mode 100644 index 9cd544ff8..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyArchivalRequest.java +++ /dev/null @@ -1,123 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="KeyArchivalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyArchivalRequest { - - private static final String CLIENT_ID = "clientID"; - private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey"; - private static final String DATA_TYPE = "dataType"; - private static final String WRAPPED_PRIVATE_DATA = "wrappedPrivateData"; - - @XmlElement - protected String clientId; - - @XmlElement - protected String transWrappedSessionKey; - - @XmlElement - protected String dataType; - - @XmlElement - protected String wrappedPrivateData; - - public KeyArchivalRequest() { - // required for JAXB (defaults) - } - - public KeyArchivalRequest(MultivaluedMap<String, String> form) { - clientId = form.getFirst(CLIENT_ID); - transWrappedSessionKey = form.getFirst(TRANS_WRAPPED_SESSION_KEY); - dataType = form.getFirst(DATA_TYPE); - wrappedPrivateData = form.getFirst(WRAPPED_PRIVATE_DATA); - } - - /** - * @return the clientId - */ - public String getClientId() { - return clientId; - } - - /** - * @param clientId the clientId to set - */ - public void setClientId(String clientId) { - this.clientId = clientId; - } - - /** - * @return the transWrappedSessionKey - */ - public String getTransWrappedSessionKey() { - return transWrappedSessionKey; - } - - /** - * @param transWrappedSessionKey the transWrappedSessionKey to set - */ - public void setTransWrappedSessionKey(String transWrappedSessionKey) { - this.transWrappedSessionKey = transWrappedSessionKey; - } - - /** - * @return the dataType - */ - public String getDataType() { - return dataType; - } - - /** - * @param dataType the dataType to set - */ - public void setDataType(String dataType) { - this.dataType = dataType; - } - - /** - * @return the wrappedPrivateData - */ - public String getWrappedPrivateData() { - return wrappedPrivateData; - } - - /** - * @param wrappedPrivateData the wrappedPrivateData to set - */ - public void setWrappedPrivateData(String wrappedPrivateData) { - this.wrappedPrivateData = wrappedPrivateData; - } - - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java deleted file mode 100644 index 3cb17d283..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRecoveryRequest.java +++ /dev/null @@ -1,155 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.netscape.certsrv.dbs.keydb.KeyId; -import com.netscape.certsrv.dbs.keydb.KeyIdAdapter; -import com.netscape.certsrv.request.RequestId; -import com.netscape.certsrv.request.RequestIdAdapter; - -/** - * @author alee - * - */ -@XmlRootElement(name="KeyRecoveryRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyRecoveryRequest { - - private static final String KEY_ID = "keyId"; - private static final String REQUEST_ID = "requestId"; - private static final String TRANS_WRAPPED_SESSION_KEY = "transWrappedSessionKey"; - private static final String SESSION_WRAPPED_PASSPHRASE = "sessionWrappedPassphrase"; - private static final String NONCE_DATA = "nonceData"; - - @XmlElement - @XmlJavaTypeAdapter(KeyIdAdapter.class) - protected KeyId keyId; - - @XmlElement - @XmlJavaTypeAdapter(RequestIdAdapter.class) - protected RequestId requestId; - - @XmlElement - protected String transWrappedSessionKey; - - @XmlElement - protected String sessionWrappedPassphrase; - - @XmlElement - protected String nonceData; - - public KeyRecoveryRequest() { - // required for JAXB (defaults) - } - - public KeyRecoveryRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(KEY_ID)) { - keyId = new KeyId(form.getFirst(KEY_ID)); - } - if (form.containsKey(REQUEST_ID)) { - requestId = new RequestId(form.getFirst(REQUEST_ID)); - } - transWrappedSessionKey = form.getFirst(TRANS_WRAPPED_SESSION_KEY); - sessionWrappedPassphrase = form.getFirst(SESSION_WRAPPED_PASSPHRASE); - nonceData = form.getFirst(NONCE_DATA); - } - - /** - * @return the keyId - */ - public KeyId getKeyId() { - return keyId; - } - - /** - * @param keyId the keyId to set - */ - public void setKeyId(KeyId keyId) { - this.keyId = keyId; - } - - /** - * @return the requestId - */ - public RequestId getRequestId() { - return requestId; - } - - /** - * @param requestId the requestId to set - */ - public void setRequestId(RequestId requestId) { - this.requestId = requestId; - } - - /** - * @return the transWrappedSessionKey - */ - public String getTransWrappedSessionKey() { - return transWrappedSessionKey; - } - - /** - * @param transWrappedSessionKey the transWrappedSessionKey to set - */ - public void setTransWrappedSessionKey(String transWrappedSessionKey) { - this.transWrappedSessionKey = transWrappedSessionKey; - } - - /** - * @return the sessionWrappedPassphrase - */ - public String getSessionWrappedPassphrase() { - return sessionWrappedPassphrase; - } - - /** - * @param sessionWrappedPassphrase the sessionWrappedPassphrase to set - */ - public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) { - this.sessionWrappedPassphrase = sessionWrappedPassphrase; - } - - /** - * @return nonceData - */ - - public String getNonceData() { - return nonceData; - } - - /** - * @param nonceData the nonceData to set - */ - - public void setNonceData(String nonceData) { - this.nonceData = nonceData; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java deleted file mode 100644 index 91d5f8210..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfo.java +++ /dev/null @@ -1,60 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -package com.netscape.cms.servlet.request.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.netscape.certsrv.dbs.keydb.KeyId; - -@XmlRootElement(name = "SecurityDataRequestInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyRequestInfo extends CMSRequestInfo { - - @XmlElement - protected String keyURL; - - public KeyRequestInfo() { - // required to be here for JAXB (defaults) - } - - /** - * @return the keyURL - */ - public String getKeyURL() { - return keyURL; - } - - /** - * @return the key ID in the keyURL - */ - public KeyId getKeyId() { - String id = keyURL.substring(keyURL.lastIndexOf("/") + 1); - return new KeyId(id); - } - - /** - * @param keyURL the keyURL to set - */ - public void setKeyURL(String keyURL) { - this.keyURL = keyURL; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java b/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java deleted file mode 100644 index dc1b6a5e4..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/KeyRequestInfos.java +++ /dev/null @@ -1,89 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.request.model; - -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import com.netscape.cms.servlet.base.model.Link; - -@XmlRootElement(name = "SecurityDataRequestInfos") -public class KeyRequestInfos { - protected Collection<KeyRequestInfo> requests; - protected List<Link> links; - - /** - * @return the requests - */ - @XmlElementRef - public Collection<KeyRequestInfo> getRequests() { - return requests; - } - - /** - * @param requests the requests to set - */ - public void setRequests(Collection<KeyRequestInfo> requests) { - this.requests = requests; - } - - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } -} diff --git a/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java b/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java deleted file mode 100644 index 8670605fc..000000000 --- a/base/common/src/com/netscape/cms/servlet/request/model/ProfileRetrievalRequest.java +++ /dev/null @@ -1,67 +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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.request.model; - -import javax.ws.rs.core.MultivaluedMap; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * @author alee - * - */ -@XmlRootElement(name = "ProfileRetrievalRequest") -@XmlAccessorType(XmlAccessType.FIELD) -public class ProfileRetrievalRequest { - - private static final String PROFILE_ID = "profileId"; - - @XmlElement - protected String profileId; - - public ProfileRetrievalRequest() { - // required for JAXB (defaults) - } - - public ProfileRetrievalRequest(MultivaluedMap<String, String> form) { - if (form.containsKey(PROFILE_ID)) { - profileId = form.getFirst(PROFILE_ID); - } - } - - /** - * @return the ProfileId - */ - public String getProfileId() { - return profileId; - } - - /** - * @param ProfileId the ProfileId to set - */ - public void setProfileId(String profileId) { - this.profileId = profileId; - } - -}
\ No newline at end of file |