diff --git a/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpFacade.java b/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpFacade.java index 497f772c31..c86a54f0a4 100755 --- a/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpFacade.java +++ b/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpFacade.java @@ -196,18 +196,7 @@ public class UndertowHttpFacade implements HttpFacade { inputStream = new BufferedInputStream(exchange.getInputStream()); - context.setServletRequest(new HttpServletRequestWrapper((HttpServletRequest) servletRequest) { - @Override - public ServletInputStream getInputStream() { - inputStream.mark(0); - return new ServletInputStream() { - @Override - public int read() throws IOException { - return inputStream.read(); - } - }; - } - }); + context.setServletRequest(UndertowHttpServletRequest.setupServletInputStream(servletRequest, inputStream)); return inputStream; } diff --git a/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java b/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java index 5f619bcfcd..338f66e22a 100644 --- a/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java +++ b/adapters/spi/undertow-adapter-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java @@ -26,7 +26,7 @@ import java.io.InputStream; public class UndertowHttpServletRequest { - public static HttpServletRequestWrapper setupServletInputStream(ServletRequest servletRequest, InputStream inputStream) { + public static HttpServletRequestWrapper setupServletInputStream(ServletRequest servletRequest, final InputStream inputStream) { return new HttpServletRequestWrapper((HttpServletRequest) servletRequest) { @Override public ServletInputStream getInputStream() { diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml index 3b071ffd0d..b768af23b4 100644 --- a/testsuite/integration-arquillian/pom.xml +++ b/testsuite/integration-arquillian/pom.xml @@ -41,7 +41,7 @@ ${java.home} - 1.6.0.Final + 1.7.0.Alpha13 3.1.4 3.14.0 diff --git a/testsuite/integration-arquillian/servers/adapter-spi/README.md b/testsuite/integration-arquillian/servers/adapter-spi/README.md new file mode 100644 index 0000000000..608f9cebcb --- /dev/null +++ b/testsuite/integration-arquillian/servers/adapter-spi/README.md @@ -0,0 +1,16 @@ +# Adapter SPI + +This module is primarily used for custom adapters in the testsuite. + +## Undertow +Modules related to Undertow: +* Keycloak Undertow Adapter SPI (`undertow-adapter-spi-jakarta`) +* Keycloak Undertow OIDC adapter (`undertow-adapter-jakarta`) +* Keycloak Undertow SAML adapter (`undertow-adapter-saml-jakarta`) + +These modules are automatically generated from the Keycloak adapters module (`/adapters`) and converted to adapters supporting JakartaEE. + +You can override files from the original module by putting the class with the same name into the `src` directory. +Do not forget to edit `.gitignore` file for changes, which should be kept in the module. + +You can check the behavior in `undertow-adapter-spi-jakarta` module and class `UndertowHttpServletRequest`. diff --git a/testsuite/integration-arquillian/servers/adapter-spi/pom.xml b/testsuite/integration-arquillian/servers/adapter-spi/pom.xml index 80af3a7f6a..b5833d40e1 100644 --- a/testsuite/integration-arquillian/servers/adapter-spi/pom.xml +++ b/testsuite/integration-arquillian/servers/adapter-spi/pom.xml @@ -14,8 +14,9 @@ Testsuite Adapter SPI - undertow-adapter-jakarta-spi + undertow-adapter-spi-jakarta undertow-adapter-jakarta + undertow-adapter-saml-jakarta diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta/pom.xml b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta/pom.xml index 55d3c22aa3..02953eb3fd 100644 --- a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta/pom.xml +++ b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta/pom.xml @@ -11,7 +11,7 @@ 4.0.0 keycloak-undertow-adapter-jakarta - App Server - Undertow (JakartaEE) + Undertow OIDC Adapter (JakartaEE) jar @@ -27,12 +27,16 @@ *;resolution:=optional - ${project.basedir}/../../../../../adapters/oidc/undertow - ${undertow-adapter-spi-base}/ + ${project.basedir}/../../../../../adapters/oidc/undertow ${project.basedir} + + org.keycloak + keycloak-undertow-adapter-spi-jakarta + ${project.version} + org.jboss.logging jboss-logging @@ -46,11 +50,6 @@ org.keycloak keycloak-adapter-spi - - org.keycloak - integration-arquillian-undertow-jakarta-spi - ${project.version} - org.keycloak keycloak-adapter-core diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/.gitignore b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/.gitignore new file mode 100644 index 0000000000..aa8e45f12b --- /dev/null +++ b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/.gitignore @@ -0,0 +1 @@ +src/ \ No newline at end of file diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/pom.xml b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/pom.xml new file mode 100644 index 0000000000..6399ec7a1f --- /dev/null +++ b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-saml-jakarta/pom.xml @@ -0,0 +1,138 @@ + + + + integration-arquillian-servers + org.keycloak.testsuite + 999-SNAPSHOT + ../../pom.xml + + 4.0.0 + + keycloak-saml-undertow-adapter-jakarta + Undertow SAML Adapter (JakartaEE) + jar + + + 11 + 11 + + ${project.basedir}/../../../../../adapters/saml/undertow + ${project.basedir} + + + + + org.keycloak + keycloak-saml-core + provided + + + org.keycloak + keycloak-adapter-spi + provided + + + org.keycloak + keycloak-common + provided + + + org.keycloak + keycloak-saml-adapter-api-public + provided + + + org.keycloak + keycloak-saml-adapter-core + provided + + + org.keycloak.testsuite + keycloak-undertow-adapter-jakarta + ${project.version} + + + org.jboss.logging + jboss-logging + provided + + + org.jboss.spec.javax.servlet + jboss-servlet-api_3.0_spec + provided + + + io.undertow + undertow-servlet + provided + + + io.undertow + undertow-core + provided + + + junit + junit + test + + + + + + + maven-antrun-plugin + + + transform + initialize + + run + + + + + + + + + + + + + + + + + + + + + + + + + + org.eclipse.transformer + org.eclipse.transformer.cli + 0.2.0 + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + + + + + + \ No newline at end of file diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/.gitignore b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/.gitignore similarity index 100% rename from testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/.gitignore rename to testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/.gitignore diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/pom.xml b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/pom.xml similarity index 91% rename from testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/pom.xml rename to testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/pom.xml index 6a1eb6e30f..a33f4aad3a 100644 --- a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/pom.xml +++ b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/pom.xml @@ -10,15 +10,15 @@ 4.0.0 - integration-arquillian-undertow-jakarta-spi - App Server - Undertow SPI (JakartaEE) + keycloak-undertow-adapter-spi-jakarta + Adapter Undertow SPI (JakartaEE) 11 11 - ${project.basedir}/../../../../../adapters/spi/undertow-adapter-spi - ${undertow-adapter-spi-base}/src/main/java/org/keycloak/adapters/undertow/ + ${project.basedir}/../../../../../adapters/spi/undertow-adapter-spi + ${undertow-adapter-base}/src/main/java/org/keycloak/adapters/undertow/ ${project.basedir}/src/main/java/org/keycloak/adapters/undertow/ diff --git a/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java b/testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java similarity index 100% rename from testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-jakarta-spi/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java rename to testsuite/integration-arquillian/servers/adapter-spi/undertow-adapter-spi-jakarta/src/main/java/org/keycloak/adapters/undertow/UndertowHttpServletRequest.java diff --git a/testsuite/integration-arquillian/servers/app-server/undertow/pom.xml b/testsuite/integration-arquillian/servers/app-server/undertow/pom.xml index 537655a5f4..1f708815e3 100644 --- a/testsuite/integration-arquillian/servers/app-server/undertow/pom.xml +++ b/testsuite/integration-arquillian/servers/app-server/undertow/pom.xml @@ -34,8 +34,9 @@ ${project.version} - org.keycloak - keycloak-saml-undertow-adapter + org.keycloak.testsuite + keycloak-saml-undertow-adapter-jakarta + ${project.version} org.keycloak diff --git a/testsuite/utils/pom.xml b/testsuite/utils/pom.xml index 3afa8cff54..4fd78ee4b3 100755 --- a/testsuite/utils/pom.xml +++ b/testsuite/utils/pom.xml @@ -186,8 +186,9 @@ keycloak-servlet-filter-adapter - org.keycloak - keycloak-saml-undertow-adapter + org.keycloak.testsuite + keycloak-saml-undertow-adapter-jakarta + ${project.version} org.keycloak