Skip to content

Commit

Permalink
Bump htmlunit version to 2.70.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sberyozkin committed Jan 30, 2023
1 parent faf8353 commit 68595e0
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 66 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ updates:
# RX Java 2
- dependency-name: io.reactivex.rxjava2:rxjava
# Test dependencies
- dependency-name: net.sourceforge.htmlunit:htmlunit
- dependency-name: io.rest-assured:*
- dependency-name: org.junit:junit-bom
- dependency-name: org.junit.jupiter:*
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<jandex-gradle-plugin.version>1.0.0</jandex-gradle-plugin.version>

<asciidoctorj.version>2.5.7</asciidoctorj.version>
<htmlunit.version>2.40.0</htmlunit.version>
<htmlunit.version>2.70.0</htmlunit.version>
<javaparser-core.version>3.24.2</javaparser-core.version>
<jdeparser.version>2.0.3.Final</jdeparser.version>
<subethasmtp.version>5.2.8</subethasmtp.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testAccessAndRefreshTokenInjectionDevMode() throws IOException, Inte

page = loginForm.getInputByName("login").click();

assertEquals("alice", page.getBody().asText());
assertEquals("alice", page.getBody().asNormalizedText());

webClient.getCookieManager().clearCookies();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testAccessAndRefreshTokenInjectionDevMode() throws IOException, Inte

// Default tenant is disabled and client secret is wrong
HtmlPage page = webClient.getPage("http://localhost:8080/unprotected");
assertEquals("unprotected", page.getBody().asText());
assertEquals("unprotected", page.getBody().asNormalizedText());

try {
webClient.getPage("http://localhost:8080/protected");
Expand Down Expand Up @@ -95,7 +95,7 @@ public void testAccessAndRefreshTokenInjectionDevMode() throws IOException, Inte

page = loginForm.getInputByName("login").click();

assertEquals("alice", page.getBody().asText());
assertEquals("alice", page.getBody().asNormalizedText());

assertEquals("custom", page.getWebClient().getCookieManager().getCookie("q_session").getValue().split("\\|")[3]);

Expand All @@ -122,7 +122,7 @@ private void useTenantConfigResolver() throws IOException, InterruptedException

page = loginForm.getInputByName("login").click();

assertEquals("tenant-config-resolver:alice", page.getBody().asText());
assertEquals("tenant-config-resolver:alice", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void testAccessUnprotectedResource() throws IOException, InterruptedExcep
try (final WebClient webClient = createWebClient()) {

HtmlPage page = webClient.getPage("http://localhost:8081/unprotected");
assertEquals("unprotected", page.getBody().asText());
assertEquals("unprotected", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public void testCodeFlowNoConsent() throws IOException {

assertEquals(
client.getAuthServerUrl(),
page.asText());
page.asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app/configMetadataScopes");

assertTrue(page.asText().contains("openid"));
assertTrue(page.asText().contains("profile"));
assertTrue(page.asNormalizedText().contains("openid"));
assertTrue(page.asNormalizedText().contains("profile"));

Cookie sessionCookie = getSessionCookie(webClient, null);
assertNotNull(sessionCookie);
Expand Down Expand Up @@ -157,7 +157,7 @@ public void testCodeFlowScopeErrorWithErrorPage() throws IOException {

HtmlPage page = webClient.getPage(URI.create(endpointErrorLocation).toURL());
assertEquals("code: b, error: invalid_scope, error_description: Invalid scopes: unknown",
page.getBody().asText());
page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down Expand Up @@ -219,7 +219,7 @@ public void testCodeFlowForceHttpsRedirectUriAndPkce() throws Exception {
assertNull(endpointLocationWithoutQueryUri.getRawQuery());

page = webClient.getPage(endpointLocationWithoutQueryUri.toURL());
assertEquals("tenant-https:reauthenticated", page.getBody().asText());
assertEquals("tenant-https:reauthenticated", page.getBody().asNormalizedText());
Cookie sessionCookie = getSessionCookie(webClient, "tenant-https_test");
assertNotNull(sessionCookie);
webClient.getCookieManager().clearCookies();
Expand Down Expand Up @@ -279,7 +279,7 @@ public void testCodeFlowForceHttpsRedirectUriWithQueryAndPkce() throws Exception
JsonObject idToken = OidcUtils.decodeJwtContent(sessionCookie.getValue().split("\\|")[0]);
String expiresAt = idToken.getInteger("exp").toString();
page = webClient.getPage(endpointLocationWithoutQueryUri.toURL());
String response = page.getBody().asText();
String response = page.getBody().asNormalizedText();
assertTrue(
response.startsWith("tenant-https:reauthenticated?code=b&expiresAt=" + expiresAt + "&expiresInDuration="));
Integer duration = Integer.valueOf(response.substring(response.length() - 1));
Expand Down Expand Up @@ -430,11 +430,11 @@ public void testRPInitiatedLogout() throws IOException {
loginForm.getInputByName("username").setValueAttribute("alice");
loginForm.getInputByName("password").setValueAttribute("alice");
page = loginForm.getInputByName("login").click();
assertEquals("Tenant Logout, refreshed: false", page.asText());
assertEquals("Tenant Logout, refreshed: false", page.asNormalizedText());
assertNotNull(getSessionCookie(webClient, "tenant-logout"));

page = webClient.getPage("http://localhost:8081/tenant-logout/logout");
assertTrue(page.asText().contains("You were logged out"));
assertTrue(page.asNormalizedText().contains("You were logged out"));
assertNull(getSessionCookie(webClient, "tenant-logout"));

page = webClient.getPage("http://localhost:8081/tenant-logout");
Expand All @@ -452,7 +452,7 @@ public void testTokenRefresh() throws IOException {
loginForm.getInputByName("username").setValueAttribute("alice");
loginForm.getInputByName("password").setValueAttribute("alice");
page = loginForm.getInputByName("login").click();
assertEquals("Tenant Refresh, refreshed: false", page.asText());
assertEquals("Tenant Refresh, refreshed: false", page.asNormalizedText());

Cookie sessionCookie = getSessionCookie(webClient, "tenant-refresh");
assertNotNull(sessionCookie);
Expand All @@ -479,7 +479,7 @@ public Boolean call() throws Exception {

// local session refreshed and still valid
page = webClient.getPage("http://localhost:8081/tenant-refresh");
assertEquals("Tenant Refresh, refreshed: false", page.asText());
assertEquals("Tenant Refresh, refreshed: false", page.asNormalizedText());
assertNotNull(getSessionCookie(webClient, "tenant-refresh"));

//wait now so that we reach the refresh timeout
Expand Down Expand Up @@ -526,7 +526,7 @@ public void testTokenAutoRefresh() throws IOException {
loginForm.getInputByName("username").setValueAttribute("alice");
loginForm.getInputByName("password").setValueAttribute("alice");
page = loginForm.getInputByName("login").click();
assertEquals("Tenant AutoRefresh, refreshed: false", page.asText());
assertEquals("Tenant AutoRefresh, refreshed: false", page.asNormalizedText());

Cookie sessionCookie = getSessionCookie(webClient, "tenant-autorefresh");
assertNotNull(sessionCookie);
Expand All @@ -535,7 +535,7 @@ public void testTokenAutoRefresh() throws IOException {
// Auto-refresh-interval is 30 secs so every call auto-refreshes the token
// Right now the original ID token is still valid but will be auto-refreshed
page = webClient.getPage("http://localhost:8081/tenant-autorefresh");
assertEquals("Tenant AutoRefresh, refreshed: true", page.asText());
assertEquals("Tenant AutoRefresh, refreshed: true", page.asNormalizedText());
sessionCookie = getSessionCookie(webClient, "tenant-autorefresh");
assertNotNull(sessionCookie);
String nextIdToken = getIdToken(sessionCookie);
Expand Down Expand Up @@ -564,7 +564,7 @@ public void testIdTokenInjection() throws IOException {

page = webClient.getPage("http://localhost:8081/web-app");

assertEquals("alice", page.getBody().asText());
assertEquals("alice", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand All @@ -585,7 +585,7 @@ public void testIdTokenInjectionWithoutRestoredPath() throws IOException, Interr

page = loginForm.getInputByName("login").click();

assertEquals("callback:alice", page.getBody().asText());
assertEquals("callback:alice", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down Expand Up @@ -621,7 +621,7 @@ public void testIdTokenInjectionJwtMethod() throws IOException, InterruptedExcep
assertNull(endpointLocationUri2.getRawQuery());

page = webClient.getPage(endpointLocationUri2.toString());
assertEquals("callback-jwt:alice", page.getBody().asText());
assertEquals("callback-jwt:alice", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down Expand Up @@ -667,11 +667,11 @@ public void testIdTokenInjectionWithoutRestoredPathDifferentRoot() throws IOExce

page = loginForm.getInputByName("login").click();

assertEquals("web-app2:alice", page.getBody().asText());
assertEquals("web-app2:alice", page.getBody().asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app2/name");

assertEquals("web-app2:alice", page.getBody().asText());
assertEquals("web-app2:alice", page.getBody().asNormalizedText());

assertNull(getStateCookie(webClient, "tenant-2"));
Cookie sessionCookie = getSessionCookie(webClient, "tenant-2");
Expand Down Expand Up @@ -735,7 +735,7 @@ public void testAuthenticationCompletionFailedWrongRedirectUri() throws IOExcept
loginForm.getInputByName("password").setValueAttribute("alice");
try {
page = loginForm.getInputByName("login").click();
fail("401 status error is expected: " + page.getBody().asText());
fail("401 status error is expected: " + page.getBody().asNormalizedText());
} catch (FailingHttpStatusCodeException ex) {
assertEquals(401, ex.getStatusCode());
assertEquals("http://localhost:8081/web-app/callback-before-wrong-redirect",
Expand Down Expand Up @@ -764,7 +764,7 @@ public void testAccessTokenInjection() throws IOException {

page = webClient.getPage("http://localhost:8081/web-app/access");

assertEquals("AT injected", page.getBody().asText());
assertEquals("AT injected", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand All @@ -788,7 +788,7 @@ public void testAccessAndRefreshTokenInjection() throws IOException {

page = webClient.getPage("http://localhost:8081/web-app/refresh");

assertEquals("RT injected", page.getBody().asText());
assertEquals("RT injected", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand All @@ -808,7 +808,7 @@ public void testAccessAndRefreshTokenInjectionWithoutIndexHtml() throws IOExcept

page = loginForm.getInputByName("login").click();

assertEquals("RT injected", page.getBody().asText());
assertEquals("RT injected", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand All @@ -827,12 +827,12 @@ public void testDefaultSessionManagerIdTokenOnly() throws IOException, Interrupt
loginForm.getInputByName("password").setValueAttribute("alice");

page = loginForm.getInputByName("login").click();
assertEquals("tenant-idtoken-only:alice", page.getBody().asText());
assertEquals("tenant-idtoken-only:alice", page.getBody().asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app/access/tenant-idtoken-only");
assertEquals("tenant-idtoken-only:no access", page.getBody().asText());
assertEquals("tenant-idtoken-only:no access", page.getBody().asNormalizedText());
page = webClient.getPage("http://localhost:8081/web-app/refresh/tenant-idtoken-only");
assertEquals("tenant-idtoken-only:no refresh", page.getBody().asText());
assertEquals("tenant-idtoken-only:no refresh", page.getBody().asNormalizedText());

Cookie idTokenCookie = getSessionCookie(page.getWebClient(), "tenant-idtoken-only");
checkSingleTokenCookie(idTokenCookie, "ID");
Expand All @@ -858,12 +858,12 @@ public void testDefaultSessionManagerIdRefreshTokens() throws IOException, Inter
loginForm.getInputByName("password").setValueAttribute("alice");

page = loginForm.getInputByName("login").click();
assertEquals("tenant-id-refresh-token:alice", page.getBody().asText());
assertEquals("tenant-id-refresh-token:alice", page.getBody().asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app/access/tenant-id-refresh-token");
assertEquals("tenant-id-refresh-token:no access", page.getBody().asText());
assertEquals("tenant-id-refresh-token:no access", page.getBody().asNormalizedText());
page = webClient.getPage("http://localhost:8081/web-app/refresh/tenant-id-refresh-token");
assertEquals("tenant-id-refresh-token:RT injected", page.getBody().asText());
assertEquals("tenant-id-refresh-token:RT injected", page.getBody().asNormalizedText());

Cookie idTokenCookie = getSessionCookie(page.getWebClient(), "tenant-id-refresh-token");
String[] parts = idTokenCookie.getValue().split("\\|");
Expand Down Expand Up @@ -894,12 +894,12 @@ public void testDefaultSessionManagerSplitTokens() throws IOException, Interrupt

page = loginForm.getInputByName("login").click();
assertEquals("tenant-split-tokens:alice, id token has 5 parts, access token has 5 parts, refresh token has 5 parts",
page.getBody().asText());
page.getBody().asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app/access/tenant-split-tokens");
assertEquals("tenant-split-tokens:AT injected", page.getBody().asText());
assertEquals("tenant-split-tokens:AT injected", page.getBody().asNormalizedText());
page = webClient.getPage("http://localhost:8081/web-app/refresh/tenant-split-tokens");
assertEquals("tenant-split-tokens:RT injected", page.getBody().asText());
assertEquals("tenant-split-tokens:RT injected", page.getBody().asNormalizedText());

Cookie idTokenCookie = getSessionCookie(page.getWebClient(), "tenant-split-tokens");
checkSingleTokenCookie(idTokenCookie, "ID", true);
Expand Down Expand Up @@ -949,12 +949,12 @@ public void testDefaultSessionManagerIdRefreshSplitTokens() throws IOException,
loginForm.getInputByName("password").setValueAttribute("alice");

page = loginForm.getInputByName("login").click();
assertEquals("tenant-split-id-refresh-token:alice", page.getBody().asText());
assertEquals("tenant-split-id-refresh-token:alice", page.getBody().asNormalizedText());

page = webClient.getPage("http://localhost:8081/web-app/access/tenant-split-id-refresh-token");
assertEquals("tenant-split-id-refresh-token:no access", page.getBody().asText());
assertEquals("tenant-split-id-refresh-token:no access", page.getBody().asNormalizedText());
page = webClient.getPage("http://localhost:8081/web-app/refresh/tenant-split-id-refresh-token");
assertEquals("tenant-split-id-refresh-token:RT injected", page.getBody().asText());
assertEquals("tenant-split-id-refresh-token:RT injected", page.getBody().asNormalizedText());

Cookie idTokenCookie = getSessionCookie(page.getWebClient(), "tenant-split-id-refresh-token");
checkSingleTokenCookie(idTokenCookie, "ID");
Expand Down Expand Up @@ -1026,7 +1026,8 @@ public void testAccessAndRefreshTokenInjectionWithoutIndexHtmlAndListener() thro

page = loginForm.getInputByName("login").click();

assertEquals("RT injected(event:OIDC_LOGIN,tenantId:tenant-listener,blockingApi:true)", page.getBody().asText());
assertEquals("RT injected(event:OIDC_LOGIN,tenantId:tenant-listener,blockingApi:true)",
page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand All @@ -1046,7 +1047,7 @@ public void testAccessAndRefreshTokenInjectionWithQuery() throws Exception {

page = loginForm.getInputByName("login").click();

assertEquals("RT injected:aValue", page.getBody().asText());
assertEquals("RT injected:aValue", page.getBody().asNormalizedText());
webClient.getCookieManager().clearCookies();
}
}
Expand Down Expand Up @@ -1129,7 +1130,7 @@ public void testCustomLogin() throws Exception {

page = loginForm.getInputByName("login").click();

assertEquals("alice", page.getBody().asText());
assertEquals("alice", page.getBody().asNormalizedText());
}
}

Expand Down
Loading

0 comments on commit 68595e0

Please sign in to comment.