Class SecurityAssert


  • public class SecurityAssert
    extends Object
    • Constructor Detail

      • SecurityAssert

        public SecurityAssert()
    • Method Detail

      • assertIsMemberOf

        public static <T extends Authorizable> void assertIsMemberOf​(Group authorizableMemberOf,
                                                                     T authorizableMember)
                                                              throws org.apache.sling.testing.clients.ClientException,
                                                                     InterruptedException
        Assert authorizableMember is member of authorizableMemberOf
        Type Parameters:
        T - a class that extends Authorizable
        Parameters:
        authorizableMemberOf - any Group that has the memberEntry
        authorizableMember - authorizable that is member of the other authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - if the membership cannot be retrieved
        InterruptedException - to mark this operation as "waiting"
      • assertIsNotMember

        public static <T extends Authorizable> void assertIsNotMember​(Group authorizableMemberOf,
                                                                      T authorizableMember)
                                                               throws org.apache.sling.testing.clients.ClientException,
                                                                      InterruptedException
        Assert authorizableMemberOf is NOT member of authorizableMember
        Type Parameters:
        T - a class that extends Authorizable
        Parameters:
        authorizableMemberOf - any Group that has the memberEntry
        authorizableMember - authorizable that is member of the other authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - if the membership cannot be retrieved
        InterruptedException - to mark this operation as "waiting"
      • assertIsNotMemberOf

        public static <T extends Authorizable> void assertIsNotMemberOf​(Group authorizableMemberOf,
                                                                        T authorizableMember)
                                                                 throws org.apache.sling.testing.clients.ClientException,
                                                                        InterruptedException
        Assert authorizableMember is NOT member of authorizableMemberOf
        Type Parameters:
        T - Authorizable class
        Parameters:
        authorizableMemberOf - any Group that has the memberEntry
        authorizableMember - authorizable that is member of the other authorizable
        Throws:
        org.apache.sling.testing.clients.ClientException - if the membership cannot be retrieved
        InterruptedException - to mark this operation as "waiting"
      • assertValidUser

        public static <T extends SecurityClient> void assertValidUser​(T client,
                                                                      String userPath)
                                                               throws org.apache.sling.testing.clients.ClientException
        Assert user is a valid user
        Type Parameters:
        T - client type CQXSSUtils
        Parameters:
        client - SecurityClient
        userPath - the path to the user, starting from root, encoded
        Throws:
        org.apache.sling.testing.clients.ClientException - if something fails during request/response cycle
      • assertACE

        public static <T extends SecurityClient> void assertACE​(T client,
                                                                String userPath)
                                                         throws org.apache.sling.testing.clients.ClientException
        Assert permissions / rep:policy node exist and has at minimum one allow or deny node
        Type Parameters:
        T - client type
        Parameters:
        client - SecurityClient
        userPath - the path to the user, starting from root
        Throws:
        org.apache.sling.testing.clients.ClientException - if something fails during request/response cycle
      • assertACENode

        public static void assertACENode​(String userPath,
                                         com.fasterxml.jackson.databind.JsonNode aceNode)
        Assert ACE node has correct resource type and structure
        Parameters:
        userPath - user path
        aceNode - ace node
      • assertValidGroup

        public static <T extends SecurityClient> void assertValidGroup​(T client,
                                                                       String groupPath)
                                                                throws org.apache.sling.testing.clients.ClientException
        Assert group is a valid group
        Type Parameters:
        T - client type
        Parameters:
        client - SecurityClient
        groupPath - the path to group starting from root
        Throws:
        org.apache.sling.testing.clients.ClientException - if something fails during request/response cycle
      • assertProfile

        public static <T extends SecurityClient> void assertProfile​(T client,
                                                                    String authorizablePath,
                                                                    HashMap<String,​String> expectedProps)
                                                             throws org.apache.sling.testing.clients.ClientException
        Assert profile information is correctly set
        Type Parameters:
        T - client type
        Parameters:
        client - SecurityClient
        authorizablePath - the path to the user, starting from root
        expectedProps - properties as map: key = propertyName, value = expected value
        Throws:
        org.apache.sling.testing.clients.ClientException - if something fails during request/response cycle