Class LoginUtil


  • public class LoginUtil
    extends Object
    • Constructor Detail

      • LoginUtil

        public LoginUtil()
    • Method Detail

      • doGetWithLoginToken

        public static org.apache.http.HttpResponse doGetWithLoginToken​(String loginToken,
                                                                       CQClient cqClient,
                                                                       String testPage)
                                                                throws IOException
        Retrieves a page using the given login token
        Parameters:
        loginToken - login token
        cqClient - client to use
        testPage - path to the page
        Returns:
        the http response
        Throws:
        IOException - if the request fails
      • getLoginToken

        public static <T extends org.apache.sling.testing.clients.AbstractSlingClient> String getLoginToken​(T graniteClient,
                                                                                                            String targetPage)
                                                                                                     throws IOException
        Retrieves a login token
        Type Parameters:
        T - client type
        Parameters:
        graniteClient - client to use
        targetPage - path to the page
        Returns:
        the login token
        Throws:
        IOException - if the request fails
      • buildFormAuthPost

        public static <T extends org.apache.sling.testing.clients.AbstractSlingClient> org.apache.http.client.methods.HttpPost buildFormAuthPost​(T graniteClient,
                                                                                                                                                 String user,
                                                                                                                                                 String pass,
                                                                                                                                                 String page)
        Creates the post request with the form for authentication
        Type Parameters:
        T - client type
        Parameters:
        graniteClient - client to use
        user - username
        pass - password
        page - path to the page
        Returns:
        the http post