5 Replies Latest reply on Mar 11, 2014 1:44 PM by Anil Saldanha

    Granting Permissions with JPA (NPE)

    Michael Kucinski Newbie

      Hello everybody!

       

      I've managed to get PicketLink working rather well with a ton of custom pieces (Custom authenticator, credentials, users, etc.) The last thing I'm trying to figure out is how to grant permissions. So far, I've tried granting permissions to my custom user class and a specific user. The granting looks like:

       

      permissionManager.grantPermission(user, CustomUsers.class, "TEST"); and permissionManager.grantPermission(user, user2, "TEST");

       

      The custom user class header looks as follows:

       

      @IdentityManaged({ CustomUsers.class })

      @Entity

      @AllowedOperations({

          @AllowedOperation(value = "CREATE", mask = 1, classOperation = true),

          @AllowedOperation(value = "READ", mask = 2),

          @AllowedOperation(value = "UPDATE", mask = 4),

          @AllowedOperation(value = "DELETE", mask = 8)

      })

      @PermissionsHandledBy(CustomUserPermissionHandler.class)

      public class CustomUsersEntity extends IdentityTypeEntity

       

       

      The CustomUserPermissionHandler.class is pretty simple and follows the example from the documentation. The problem is that when I go to grant the permissions, I get a null pointer caused by the PermissionEntityMapper in the JPAIdentityStore (There are none!). I also found the annotation @PermissionManaged which is not mentioned in the documentation. Am I missing something?