summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/user
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-10-08 16:02:19 -0400
committerEndi S. Dewata <edewata@redhat.com>2013-10-25 17:16:27 -0400
commit7ca5adf1bd5bc4f9a7c5f2035426b9158007bb28 (patch)
treea4f829050bcdbbf55105b26cc155e615a5bdf3c1 /base/common/src/com/netscape/certsrv/user
parent00423180cc2fcfa97a6d9ca515588d703d7235ab (diff)
downloadpki-7ca5adf1bd5bc4f9a7c5f2035426b9158007bb28.tar.gz
pki-7ca5adf1bd5bc4f9a7c5f2035426b9158007bb28.tar.xz
pki-7ca5adf1bd5bc4f9a7c5f2035426b9158007bb28.zip
Fixed problems finding user and group sub-resources.
Due to a regression RESTEasy is unable to find some sub-resources properly. As a workaround some resources need to be merged into the parent resource. The UserCertResource and UserMembershipResource have been merged into UserResource. The GroupMemberResource has been merged into GroupResource.
Diffstat (limited to 'base/common/src/com/netscape/certsrv/user')
-rw-r--r--base/common/src/com/netscape/certsrv/user/UserCertResource.java68
-rw-r--r--base/common/src/com/netscape/certsrv/user/UserClient.java18
-rw-r--r--base/common/src/com/netscape/certsrv/user/UserMembershipResource.java62
-rw-r--r--base/common/src/com/netscape/certsrv/user/UserResource.java46
4 files changed, 53 insertions, 141 deletions
diff --git a/base/common/src/com/netscape/certsrv/user/UserCertResource.java b/base/common/src/com/netscape/certsrv/user/UserCertResource.java
deleted file mode 100644
index 81133df3b..000000000
--- a/base/common/src/com/netscape/certsrv/user/UserCertResource.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) 2012 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.certsrv.user;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-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.Response;
-
-import org.jboss.resteasy.annotations.ClientResponseType;
-
-import com.netscape.certsrv.acls.ACLMapping;
-import com.netscape.certsrv.authentication.AuthMethodMapping;
-
-/**
- * @author Endi S. Dewata
- */
-@Path("admin/users/{userID}/certs")
-@ACLMapping("admin.users")
-@AuthMethodMapping("admin")
-public interface UserCertResource {
-
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public UserCertCollection findUserCerts(
- @PathParam("userID") String userID,
- @QueryParam("start") Integer start,
- @QueryParam("size") Integer size);
-
-
- @POST
- @ClientResponseType(entityType=UserCertData.class)
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response addUserCert(@PathParam("userID") String userID, UserCertData userCertData);
-
- @GET
- @Path("{certID}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public UserCertData getUserCert(@PathParam("userID") String userID, @PathParam("certID") String certID);
-
- @DELETE
- @Path("{certID}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public void removeUserCert(@PathParam("userID") String userID, @PathParam("certID") String certID);
-}
diff --git a/base/common/src/com/netscape/certsrv/user/UserClient.java b/base/common/src/com/netscape/certsrv/user/UserClient.java
index 85b7f0592..59de64652 100644
--- a/base/common/src/com/netscape/certsrv/user/UserClient.java
+++ b/base/common/src/com/netscape/certsrv/user/UserClient.java
@@ -30,8 +30,6 @@ import com.netscape.certsrv.client.PKIClient;
public class UserClient extends Client {
public UserResource userClient;
- public UserCertResource userCertClient;
- public UserMembershipResource userMembershipClient;
public UserClient(PKIClient client, String subsystem) throws URISyntaxException {
super(client, subsystem, "user");
@@ -40,8 +38,6 @@ public class UserClient extends Client {
public void init() throws URISyntaxException {
userClient = createProxy(UserResource.class);
- userCertClient = createProxy(UserCertResource.class);
- userMembershipClient = createProxy(UserMembershipResource.class);
}
public UserCollection findUsers(String filter, Integer start, Integer size) {
@@ -69,34 +65,34 @@ public class UserClient extends Client {
}
public UserCertCollection findUserCerts(String userID, Integer start, Integer size) {
- return userCertClient.findUserCerts(userID, start, size);
+ return userClient.findUserCerts(userID, start, size);
}
public UserCertData getUserCert(String userID, String certID) {
- return userCertClient.getUserCert(userID, certID);
+ return userClient.getUserCert(userID, certID);
}
public UserCertData addUserCert(String userID, UserCertData userCertData) {
@SuppressWarnings("unchecked")
- ClientResponse<UserCertData> response = (ClientResponse<UserCertData>)userCertClient.addUserCert(userID, userCertData);
+ ClientResponse<UserCertData> response = (ClientResponse<UserCertData>)userClient.addUserCert(userID, userCertData);
return client.getEntity(response);
}
public void removeUserCert(String userID, String certID) {
- userCertClient.removeUserCert(userID, certID);
+ userClient.removeUserCert(userID, certID);
}
public UserMembershipCollection findUserMemberships(String userID, Integer start, Integer size) {
- return userMembershipClient.findUserMemberships(userID, start, size);
+ return userClient.findUserMemberships(userID, start, size);
}
public UserMembershipData addUserMembership(String userID, String groupID) {
@SuppressWarnings("unchecked")
- ClientResponse<UserMembershipData> response = (ClientResponse<UserMembershipData>)userMembershipClient.addUserMembership(userID, groupID);
+ ClientResponse<UserMembershipData> response = (ClientResponse<UserMembershipData>)userClient.addUserMembership(userID, groupID);
return client.getEntity(response);
}
public void removeUserMembership(String userD, String groupID) {
- userMembershipClient.removeUserMembership(userD, groupID);
+ userClient.removeUserMembership(userD, groupID);
}
}
diff --git a/base/common/src/com/netscape/certsrv/user/UserMembershipResource.java b/base/common/src/com/netscape/certsrv/user/UserMembershipResource.java
deleted file mode 100644
index 665a419e3..000000000
--- a/base/common/src/com/netscape/certsrv/user/UserMembershipResource.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) 2013 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.certsrv.user;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-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.Response;
-
-import org.jboss.resteasy.annotations.ClientResponseType;
-
-import com.netscape.certsrv.acls.ACLMapping;
-import com.netscape.certsrv.authentication.AuthMethodMapping;
-
-/**
- * @author Endi S. Dewata
- */
-@Path("admin/users/{userID}/memberships")
-@ACLMapping("admin.users")
-@AuthMethodMapping("admin")
-public interface UserMembershipResource {
-
- @GET
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public UserMembershipCollection findUserMemberships(
- @PathParam("userID") String userID,
- @QueryParam("start") Integer start,
- @QueryParam("size") Integer size);
-
- @POST
- @ClientResponseType(entityType=UserMembershipData.class)
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response addUserMembership(@PathParam("userID") String userID, String groupID);
-
- @DELETE
- @Path("{groupID}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public void removeUserMembership(@PathParam("userID") String userID, @PathParam("groupID") String groupID);
-}
diff --git a/base/common/src/com/netscape/certsrv/user/UserResource.java b/base/common/src/com/netscape/certsrv/user/UserResource.java
index a0f5f1db5..961f5ebda 100644
--- a/base/common/src/com/netscape/certsrv/user/UserResource.java
+++ b/base/common/src/com/netscape/certsrv/user/UserResource.java
@@ -74,4 +74,50 @@ public interface UserResource {
@Path("{userID}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void removeUser(@PathParam("userID") String userID);
+
+ @GET
+ @Path("{userID}/certs")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public UserCertCollection findUserCerts(
+ @PathParam("userID") String userID,
+ @QueryParam("start") Integer start,
+ @QueryParam("size") Integer size);
+
+
+ @POST
+ @Path("{userID}/certs")
+ @ClientResponseType(entityType=UserCertData.class)
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public Response addUserCert(@PathParam("userID") String userID, UserCertData userCertData);
+
+ @GET
+ @Path("{userID}/certs/{certID}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public UserCertData getUserCert(@PathParam("userID") String userID, @PathParam("certID") String certID);
+
+ @DELETE
+ @Path("{userID}/certs/{certID}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public void removeUserCert(@PathParam("userID") String userID, @PathParam("certID") String certID);
+
+ @GET
+ @Path("{userID}/memberships")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public UserMembershipCollection findUserMemberships(
+ @PathParam("userID") String userID,
+ @QueryParam("start") Integer start,
+ @QueryParam("size") Integer size);
+
+ @POST
+ @Path("{userID}/memberships")
+ @ClientResponseType(entityType=UserMembershipData.class)
+ @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public Response addUserMembership(@PathParam("userID") String userID, String groupID);
+
+ @DELETE
+ @Path("{userID}/memberships/{groupID}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+ public void removeUserMembership(@PathParam("userID") String userID, @PathParam("groupID") String groupID);
}