0 Replies Latest reply on Mar 24, 2016 1:32 PM by Assistenza BSS

    AllowedOperations on MappedSuperclasses and RequiresPermission on AbstractFacade

    Assistenza BSS Newbie

      Hi to all.

       

      I'am followind the quickstart "authorization-acl" at https://github.com/jboss-developer/jboss-picketlink-quickstarts/tree/master/picketlink-authorization-acl .

       

      It's simple and it's work.

       

      In my project, I have a lot of entity classes that extend an abstract MappedSuperclass. Is it possible to put annotation on that class and automatically extends to all sub classes?

      @MappedSuperclass
      @AllowedOperations({
          @AllowedOperation(value = STANDARD_OP.READ, mask = 1, classOperation = true),
          @AllowedOperation(value = STANDARD_OP.CREATE, mask = 2, classOperation = true),
          @AllowedOperation(value = STANDARD_OP.UPDATE, mask = 4),
          @AllowedOperation(value = STANDARD_OP.DELETE, mask = 8),
          @AllowedOperation(value = STANDARD_OP.PRINT, mask = 16, classOperation = true)
      })
      public abstract class EntityBase implements EntityInterface<Long> {
      ...
      }
      
      public class Country extends EntityBase{...}
      

       

      Same thing for controllers. Is it possible to put @RequiresPermission on interface that is shared by a lot of EJB ?

      public interface InterfacciaFacadeRemote<T extends EntityInterface> extends Serializable{
      ...
          @POST @javax.ws.rs.Path("cercatutti")
          @Produces(MediaType.APPLICATION_JSON)
          @RequiresPermission(resourceClass = EntityBase.class, operation = STANDARD_OP.READ)
          public List<T> findall();
      ...
      }
      
      @Path(value="restresource")
      public interface RestResourceFacadeRemote extends InterfacciaFacadeRemote<RestResource>{...}
      
      public class RestResourceFacade extends AbstractFacade<RestResource> implements RestResourceFacadeRemote {...}
      

      I want to check permissions on RestResourceFacade.findall() using annotation on the interface or on the AbstractFacade (same method, same permission on multiple facade).

       

      I tryed but it doesn't work for me. Did I miss something? Does special configurations are required?