Commit 6bfcfe9d authored by shake's avatar shake
Browse files

Added tomcat auth for rest services

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@182 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent a3645255
......@@ -7,6 +7,7 @@ package edu.umiacs.ace.rest;
import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.util.PersistUtil;
import javax.annotation.security.RolesAllowed;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.ws.rs.Consumes;
......@@ -40,6 +41,7 @@ public class CollectionManagement {
@POST
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@RolesAllowed("Collection Modify")
public void addCollection(Collection coll){
checkCollection(coll);
EntityManager em = PersistUtil.getEntityManager();
......@@ -52,6 +54,7 @@ public class CollectionManagement {
@GET
@Produces(MediaType.APPLICATION_XML)
@Path("xml/{id}")
@RolesAllowed("Browse")
public Collection getCollectionXML(@PathParam("id") long collId){
EntityManager em = PersistUtil.getEntityManager();
return em.find(Collection.class, collId);
......@@ -60,6 +63,7 @@ public class CollectionManagement {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("json/{id}")
@RolesAllowed("Browse")
public Collection getCollectionJSON(@PathParam("id") long collId){
EntityManager em = PersistUtil.getEntityManager();
return em.find(Collection.class, collId);
......
......@@ -720,6 +720,22 @@
<role-name>Modify System Settings</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<display-name>Rest</display-name>
<web-resource-collection>
<web-resource-name>CollectionManagement</web-resource-name>
<description/>
<url-pattern>/rest/collection/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>Collection Modify</role-name>
<role-name>Browse</role-name>
</auth-constraint>
M
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Audit Manager</realm-name>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment