diff --git a/appserver/pom.xml b/appserver/pom.xml index e3d5c89c7b5..4650d25cb4b 100644 --- a/appserver/pom.xml +++ b/appserver/pom.xml @@ -97,12 +97,12 @@ - 4.0.0-M1 - 3.0.0-M1 + 4.0.0-M2 + 3.0.0-M2 3.1.0-M1 - 4.0.0-M1 - 3.0.0-M1.1 + 4.0.0-M2 + 3.0.0-M2 3.1.0-M1 9.38-rc3 @@ -158,7 +158,7 @@ 3.1 - 4.0.5 + 4.0.6 2.1 diff --git a/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/defaultp2r/DefaultP2RAuthTest.java b/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/defaultp2r/DefaultP2RAuthTest.java index d6f77ca03c6..ea7e96a460f 100644 --- a/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/defaultp2r/DefaultP2RAuthTest.java +++ b/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/defaultp2r/DefaultP2RAuthTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Eclipse Foundation and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024 Eclipse Foundation and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -25,7 +25,7 @@ import java.io.File; import java.lang.System.Logger; -import java.net.URL; +import java.net.URI; import org.glassfish.main.itest.tools.GlassFishTestEnvironment; import org.glassfish.main.itest.tools.HttpClient10; import org.glassfish.main.itest.tools.HttpClient10.HttpResponse; @@ -94,16 +94,20 @@ public static void cleanup() { @Test void p2rEnabled() throws Exception { + LOG.log(INFO, "Running p2rEnabled"); + assertThat(ASADMIN.exec("set", SERVER_CFG_PROPERTY + "=true"), asadminOK()); assertThat(ASADMIN.exec("deploy", "--target", "server", warFile.getAbsolutePath()), asadminOK()); - HttpClient10 client = new HttpClient10(new URL("http://localhost:8080/" + APP_NAME + "/TestServlet"), + HttpClient10 client = new HttpClient10(new URI("http://localhost:8080/" + APP_NAME + "/TestServlet").toURL(), USER_NAME, USER_PASSWORD); + HttpResponse responseFoo = client.send("FOO", null); assertAll( () -> assertThat(responseFoo.responseLine, equalTo("HTTP/1.1 200 OK")), () -> assertThat(responseFoo.body, equalTo("doFoo with bobby")) ); + HttpResponse responseGet = client.send("GET", null); assertAll( () -> assertThat(responseGet.responseLine, equalTo("HTTP/1.1 200 OK")), @@ -114,11 +118,14 @@ void p2rEnabled() throws Exception { @Test void p2rDisabled() throws Exception { + LOG.log(INFO, "Running p2rDisabled"); + assertThat(ASADMIN.exec("set", SERVER_CFG_PROPERTY + "=false"), asadminOK()); assertThat(ASADMIN.exec("deploy", "--target", "server", warFile.getAbsolutePath()), asadminOK()); - HttpClient10 client = new HttpClient10(new URL("http://localhost:8080/" + APP_NAME + "/TestServlet"), + HttpClient10 client = new HttpClient10(new URI("http://localhost:8080/" + APP_NAME + "/TestServlet").toURL(), USER_NAME, USER_PASSWORD); + HttpResponse responseGet = client.send("GET", null); assertThat(responseGet.responseLine, equalTo("HTTP/1.1 403 Forbidden")); } diff --git a/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/jmac/http/servlet/basic/HttpServletBasicAuthTest.java b/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/jmac/http/servlet/basic/HttpServletBasicAuthTest.java index d6e3cd2abd7..505f4143085 100644 --- a/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/jmac/http/servlet/basic/HttpServletBasicAuthTest.java +++ b/appserver/tests/application/src/test/java/org/glassfish/main/test/app/security/jmac/http/servlet/basic/HttpServletBasicAuthTest.java @@ -63,7 +63,7 @@ public class HttpServletBasicAuthTest { private static File warFile; private static File keyFile; - private static File loginModuleFile; + private static File serverAuthModuleFile; @BeforeAll public static void prepareDeployment() { @@ -75,12 +75,15 @@ public static void prepareDeployment() { asadminOK()); createFileUser(FILE_REALM_NAME, USER_NAME, USER_PASSWORD, "mygroup"); - JavaArchive loginModule = ShrinkWrap.create(JavaArchive.class).addClass(MyHttpServletResponseWrapper.class) - .addClass(HttpServletTestAuthModule.class).addClass(MyPrintWriter.class); - LOG.log(INFO, loginModule.toString(true)); - loginModuleFile = new File(getDomain1Directory().toAbsolutePath().resolve("../../lib").toFile(), + JavaArchive serverAuthModule = ShrinkWrap.create(JavaArchive.class) + .addClass(MyHttpServletResponseWrapper.class) + .addClass(HttpServletTestAuthModule.class) + .addClass(MyPrintWriter.class); + + LOG.log(INFO, serverAuthModule.toString(true)); + serverAuthModuleFile = new File(getDomain1Directory().toAbsolutePath().resolve("../../lib").toFile(), "testLoginModule.jar"); - loginModule.as(ZipExporter.class).exportTo(loginModuleFile, true); + serverAuthModule.as(ZipExporter.class).exportTo(serverAuthModuleFile, true); assertThat(ASADMIN.exec("create-message-security-provider", "--classname", HttpServletTestAuthModule.class.getName(), @@ -96,7 +99,7 @@ public static void prepareDeployment() { warFile = new File(tempDir, APP_NAME + ".war"); webArchive.as(ZipExporter.class).exportTo(warFile, true); - assertThat(ASADMIN.exec("deploy", "--libraries", loginModuleFile.getAbsolutePath(), "--target", "server", + assertThat(ASADMIN.exec("deploy", "--libraries", serverAuthModuleFile.getAbsolutePath(), "--target", "server", warFile.getAbsolutePath()), asadminOK()); } @@ -109,7 +112,7 @@ public static void cleanup() { ASADMIN.exec("delete-auth-realm", FILE_REALM_NAME); delete(warFile); delete(keyFile); - delete(loginModuleFile); + delete(serverAuthModuleFile); } @@ -117,9 +120,12 @@ public static void cleanup() { void test() throws Exception { HttpURLConnection connection = openConnection(8080, "/" + APP_NAME + "/index.jsp"); connection.setRequestMethod("GET"); + String basicAuth = Base64.getEncoder().encodeToString((USER_NAME + ":" + USER_PASSWORD).getBytes(UTF_8)); connection.setRequestProperty("Authorization", "Basic " + basicAuth); + assertThat(connection.getResponseCode(), equalTo(200)); + try (InputStream is = connection.getInputStream()) { String text = new String(is.readAllBytes(), UTF_8); assertThat(text, stringContainsInOrder( diff --git a/nucleus/parent/pom.xml b/nucleus/parent/pom.xml index bc8ded2a27e..e103c64c585 100644 --- a/nucleus/parent/pom.xml +++ b/nucleus/parent/pom.xml @@ -140,7 +140,7 @@ 2.7.8 1.10.14 1.10.2 - 2.17.0-rc1 + 2.17.0 1.7.0 1.0-2 1.5.4 @@ -924,7 +924,7 @@ com.puppycrawl.tools checkstyle - 10.14.1 + 10.14.2