diff --git a/security-openid-connect-multi-tenancy-quickstart/pom.xml b/security-openid-connect-multi-tenancy-quickstart/pom.xml index f4f8280f67..b4518a7811 100644 --- a/security-openid-connect-multi-tenancy-quickstart/pom.xml +++ b/security-openid-connect-multi-tenancy-quickstart/pom.xml @@ -18,7 +18,7 @@ 17 17 UTF-8 - 2.36.0 + 4.7.0 @@ -59,20 +59,10 @@ test - net.sourceforge.htmlunit + org.htmlunit htmlunit ${htmlunit.version} test - - - org.apache.httpcomponents - httpmime - - - commons-logging - commons-logging - - diff --git a/security-openid-connect-multi-tenancy-quickstart/src/main/resources/application.properties b/security-openid-connect-multi-tenancy-quickstart/src/main/resources/application.properties index b06b723b5d..606377d754 100644 --- a/security-openid-connect-multi-tenancy-quickstart/src/main/resources/application.properties +++ b/security-openid-connect-multi-tenancy-quickstart/src/main/resources/application.properties @@ -14,4 +14,4 @@ quarkus.http.auth.permission.public.policy=permit quarkus.keycloak.devservices.realm-path=default-tenant-realm.json,tenant-a-realm.json -quarkus.log.category."com.gargoylesoftware.htmlunit".level=ERROR +quarkus.log.category."org.htmlunit".level=ERROR diff --git a/security-openid-connect-multi-tenancy-quickstart/src/test/java/org/acme/quickstart/oidc/CodeFlowTest.java b/security-openid-connect-multi-tenancy-quickstart/src/test/java/org/acme/quickstart/oidc/CodeFlowTest.java index eae94b0bde..a2d6071ed2 100644 --- a/security-openid-connect-multi-tenancy-quickstart/src/test/java/org/acme/quickstart/oidc/CodeFlowTest.java +++ b/security-openid-connect-multi-tenancy-quickstart/src/test/java/org/acme/quickstart/oidc/CodeFlowTest.java @@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test; -import com.gargoylesoftware.htmlunit.SilentCssErrorHandler; -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlPage; +import org.htmlunit.SilentCssErrorHandler; +import org.htmlunit.WebClient; +import org.htmlunit.html.HtmlForm; +import org.htmlunit.html.HtmlPage; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.client.KeycloakTestClient; @@ -34,9 +34,9 @@ public void testLogInDefaultTenant() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); - assertTrue(page.asText().contains("tenant")); + assertTrue(page.asNormalizedText().contains("tenant")); webClient.getCookieManager().clearCookies(); } @@ -54,9 +54,9 @@ public void testLogInTenantAWebApp() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); - assertTrue(page.asText().contains("alice@tenant-a.org")); + assertTrue(page.asNormalizedText().contains("alice@tenant-a.org")); webClient.getCookieManager().clearCookies(); } } @@ -83,9 +83,9 @@ public void testReAuthenticateWhenSwitchingTenants() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); - assertTrue(page.asText().contains("alice@tenant-a.org")); + assertTrue(page.asNormalizedText().contains("alice@tenant-a.org")); page = webClient.getPage("http://localhost:8081/default"); @@ -96,9 +96,9 @@ public void testReAuthenticateWhenSwitchingTenants() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); - assertTrue(page.asText().contains("alice@keycloak.org")); + assertTrue(page.asNormalizedText().contains("alice@keycloak.org")); webClient.getCookieManager().clearCookies(); } diff --git a/security-openid-connect-web-authentication-quickstart/pom.xml b/security-openid-connect-web-authentication-quickstart/pom.xml index fa1dcb3edb..78927aef70 100644 --- a/security-openid-connect-web-authentication-quickstart/pom.xml +++ b/security-openid-connect-web-authentication-quickstart/pom.xml @@ -17,7 +17,7 @@ 17 17 UTF-8 - 2.36.0 + 4.7.0 @@ -57,20 +57,10 @@ test - net.sourceforge.htmlunit + org.htmlunit htmlunit ${htmlunit.version} test - - - org.apache.httpcomponents - httpmime - - - commons-logging - commons-logging - - diff --git a/security-openid-connect-web-authentication-quickstart/src/main/resources/application.properties b/security-openid-connect-web-authentication-quickstart/src/main/resources/application.properties index 057c061d47..b07594e199 100644 --- a/security-openid-connect-web-authentication-quickstart/src/main/resources/application.properties +++ b/security-openid-connect-web-authentication-quickstart/src/main/resources/application.properties @@ -9,4 +9,4 @@ quarkus.http.auth.permission.authenticated.paths=/* quarkus.http.auth.permission.authenticated.policy=authenticated quarkus.http.auth.permission.public.paths=/q* quarkus.http.auth.permission.public.policy=permit -quarkus.log.category."com.gargoylesoftware.htmlunit".level=ERROR +quarkus.log.category."org.htmlunit".level=ERROR diff --git a/security-openid-connect-web-authentication-quickstart/src/test/java/org/acme/security/openid/connect/web/authentication/CodeFlowTest.java b/security-openid-connect-web-authentication-quickstart/src/test/java/org/acme/security/openid/connect/web/authentication/CodeFlowTest.java index 780ba1a40a..1c63ff139e 100644 --- a/security-openid-connect-web-authentication-quickstart/src/test/java/org/acme/security/openid/connect/web/authentication/CodeFlowTest.java +++ b/security-openid-connect-web-authentication-quickstart/src/test/java/org/acme/security/openid/connect/web/authentication/CodeFlowTest.java @@ -12,11 +12,11 @@ import org.junit.jupiter.api.Test; -import com.gargoylesoftware.htmlunit.SilentCssErrorHandler; -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import com.gargoylesoftware.htmlunit.util.Cookie; +import org.htmlunit.SilentCssErrorHandler; +import org.htmlunit.WebClient; +import org.htmlunit.html.HtmlForm; +import org.htmlunit.html.HtmlPage; +import org.htmlunit.util.Cookie; import io.quarkus.test.junit.QuarkusTest; @@ -38,7 +38,7 @@ public void testCodeFlowNoConsent() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); assertEquals("Welcome to Your Quarkus Application", page.getTitleText()); @@ -68,7 +68,7 @@ public void testTokenTimeoutLogout() throws IOException, InterruptedException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); assertEquals("Welcome to Your Quarkus Application", page.getTitleText()); @@ -125,15 +125,16 @@ public void testTokenInjection() throws IOException { loginForm.getInputByName("username").setValueAttribute("alice"); loginForm.getInputByName("password").setValueAttribute("alice"); - page = loginForm.getInputByName("login").click(); + page = loginForm.getButtonByName("login").click(); assertEquals("Welcome to Your Quarkus Application", page.getTitleText()); page = webClient.getPage("http://localhost:8081/tokens"); - assertTrue(page.getBody().asText().contains("username")); - assertTrue(page.getBody().asText().contains("scopes")); - assertTrue(page.getBody().asText().contains("refresh_token: true")); + String text = page.getBody().asNormalizedText(); + assertTrue(text.contains("username")); + assertTrue(text.contains("scopes")); + assertTrue(text.contains("refresh_token: true")); assertNotNull(getSessionCookie(webClient)); assertNull(getStateCookies(webClient));