Search in sources :

Example 71 with WebClient

use of com.gargoylesoftware.htmlunit.WebClient in project Payara by payara.

the class OpenIdELPerSessionTest method testOpenIdConnect2Tenants.

/**
 * Tests that it's possible to authenticate as 2 different tenants in 2 sessions. Tenant specifies a provider, each session should use a different OIDC provider and authenticate as a different user. Tenant-specific configuration is in microprofile-config.properties.
 */
@Test
@RunAsClient
public void testOpenIdConnect2Tenants() throws IOException {
    WebClient clientForSecondTenant = new WebClient();
    OpenIdTestUtil.testOpenIdConnect2Tenants(base, webClient, clientForSecondTenant);
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 72 with WebClient

use of com.gargoylesoftware.htmlunit.WebClient in project Payara by payara.

the class PayaraExpressionConfigPropertiesIT method testAliasSubstitution.

@Test
public void testAliasSubstitution() throws Exception {
    try (WebClient client = new WebClient()) {
        TextPage page = client.getPage(url + "ConfigServlet");
        System.out.println(page.getContent());
        assertTrue("Expected \"Normal Notation\" to give wobbles", page.getContent().contains("Normal Notation: wobbles"));
        assertTrue("Expected \"Substitution Notation\" to give wobbles", page.getContent().contains("Substitution Notation: wobbles"));
        assertTrue("Expected \"Password Alias from File\" to give wobbles", page.getContent().contains("Password Alias from File: wobbles"));
        assertTrue("Expected \"System Property Alias from File\" to give Tiddles!", page.getContent().contains("System Property Alias from File: Tiddles!"));
        assertTrue("Expected \"Environment Variable Alias referencing System Property Alias from File\" to give Dobbles", page.getContent().contains("Environment Variable Alias referencing System Property Alias from File: Dobbles"));
        assertTrue("Expected \"Environment Variable Alias and System Property Alias from File (same property)\" to give Bibbles and Bobbles", page.getContent().contains("Environment Variable Alias and System Property Alias from File (same property): Bibbles and Bobbles"));
    }
}
Also used : TextPage(com.gargoylesoftware.htmlunit.TextPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Example 73 with WebClient

use of com.gargoylesoftware.htmlunit.WebClient in project Payara by payara.

the class InvalidRedirectURITest method testOpenIdConnect.

@Test
@RunAsClient
public void testOpenIdConnect() throws IOException {
    try {
        WebClient webClient = new WebClient();
        webClient.getPage(base + "Secured");
        fail("redirect uri is valid");
    } catch (FailingHttpStatusCodeException ex) {
        assertEquals(NOT_FOUND.getStatusCode(), ex.getStatusCode());
    }
}
Also used : FailingHttpStatusCodeException(com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException) WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 74 with WebClient

use of com.gargoylesoftware.htmlunit.WebClient in project Payara by payara.

the class OpenIdELPerSessionInEarTest method testOpenIdConnect2Tenants.

/**
 * Tests that it's possible to authenticate as 2 different tenants in 2
 * sessions. Tenant specifies a provider, each session should use a
 * different OIDC provider and authenticate as a different user.
 * Tenant-specific configuration is in microprofile-config.properties.
 */
@Test
@RunAsClient
public void testOpenIdConnect2Tenants() throws IOException {
    WebClient clientForSecondTenant = new WebClient();
    OpenIdTestUtil.testOpenIdConnect2Tenants(base, webClient, clientForSecondTenant);
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 75 with WebClient

use of com.gargoylesoftware.htmlunit.WebClient in project Payara by payara.

the class UseCookiesTest method testOpenIdConnect.

@Test
@RunAsClient
public void testOpenIdConnect() throws IOException {
    WebClient webClient = new WebClient();
    URL baseHttps = ServerOperations.createClientTrustStore(webClient, base, ServerOperations.addClientCertificateFromServer(base));
    OpenIdTestUtil.testOpenIdConnect(webClient, baseHttps);
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

WebClient (com.gargoylesoftware.htmlunit.WebClient)182 Test (org.junit.Test)110 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)55 Page (com.gargoylesoftware.htmlunit.Page)33 TextPage (com.gargoylesoftware.htmlunit.TextPage)21 Before (org.junit.Before)20 HtmlSubmitInput (com.gargoylesoftware.htmlunit.html.HtmlSubmitInput)17 URL (java.net.URL)14 JsonObject (javax.json.JsonObject)13 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)13 WebResponse (com.gargoylesoftware.htmlunit.WebResponse)12 SpecAssertion (org.jboss.test.audit.annotations.SpecAssertion)11 HtmlSpan (com.gargoylesoftware.htmlunit.html.HtmlSpan)10 ReadContext (com.jayway.jsonpath.ReadContext)10 File (java.io.File)9 IOException (java.io.IOException)8 NicelyResynchronizingAjaxController (com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController)7 Test (org.junit.jupiter.api.Test)7 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)6 DefaultCredentialsProvider (com.gargoylesoftware.htmlunit.DefaultCredentialsProvider)5