diff --git a/bom/pom.xml b/bom/pom.xml new file mode 100644 index 0000000000..923fdd4257 --- /dev/null +++ b/bom/pom.xml @@ -0,0 +1,60 @@ + + + + + shiro-root + org.apache.shiro + 1.11.0-SNAPSHOT + + 4.0.0 + + shiro-bom + Apache Shiro :: BOM + pom + + + + org.apache.shiro + shiro-web + jakarta + ${project.version} + + + org.apache.shiro + * + + + + + org.apache.shiro + shiro-jaxrs + jakarta + ${project.version} + + + org.apache.shiro + * + + + + + \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml index 136c3df334..9b23c553fd 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -64,6 +64,10 @@ + + org.apache.maven.plugins + maven-shade-plugin + diff --git a/crypto/cipher/pom.xml b/crypto/cipher/pom.xml index 5d87fedf2f..29a84e5805 100644 --- a/crypto/cipher/pom.xml +++ b/crypto/cipher/pom.xml @@ -47,6 +47,10 @@ + + org.apache.maven.plugins + maven-shade-plugin + diff --git a/pom.xml b/pom.xml index c3757d4c54..b636e865e6 100644 --- a/pom.xml +++ b/pom.xml @@ -147,6 +147,7 @@ samples integration-tests test-coverage + bom @@ -439,6 +440,70 @@ true + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + + jakarta + package + + shade + + + false + true + jakarta + false + + + + + + ${project.groupId}:${project.artifactId} + + + + + javax.annotation + jakarta.annotation + + javax.annotation.processing.** + + + + javax.enterprise + jakarta.enterprise + + javax.enterprise.deploy.** + + + + javax.inject + jakarta.inject + + + javax.json + jakarta.json + + + javax.servlet + jakarta.servlet + + + javax.websocket + jakarta.websocket + + + javax.ws.rs + jakarta.ws.rs + + + + + + diff --git a/samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml b/samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml index 62498085a4..3e5fbe9732 100644 --- a/samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml +++ b/samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml @@ -23,7 +23,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> -<<<<<<< HEAD:samples/jaxrs/src/main/webapp/WEB-INF/web.cxf.xml CXFServlet CXF Servlet @@ -38,12 +37,5 @@ CXFServlet /* -======= - - org.apache.shiro - shiro-crypto - 2.0.0-SNAPSHOT - ->>>>>>> c7f359b7... [SHIRO-848] - Relative Path in pom.xml is not needed:crypto/support/pom.xml diff --git a/samples/pom.xml b/samples/pom.xml index 5c0ec59912..4ca179c139 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -50,6 +50,7 @@ quickstart-guice servlet-plugin jaxrs + web-jakarta @@ -63,4 +64,3 @@ - diff --git a/samples/web-jakarta/pom.xml b/samples/web-jakarta/pom.xml new file mode 100644 index 0000000000..9ae04ab426 --- /dev/null +++ b/samples/web-jakarta/pom.xml @@ -0,0 +1,157 @@ + + + + + org.apache.shiro.samples + shiro-samples + 1.11.0-SNAPSHOT + + + 4.0.0 + samples-web-jakarta + Apache Shiro :: Samples :: Web Jakarta + war + + + 1.2.14 + 10.0.27 + + + + + org.apache.shiro + shiro-core + jakarta + ${project.version} + + + org.apache.shiro + shiro-web + jakarta + ${project.version} + + + org.apache.shiro + * + + + + + org.apache.logging.log4j + log4j-slf4j-impl + compile + + + org.apache.logging.log4j + log4j-core + compile + + + org.apache.logging.log4j + log4j-api + compile + + + org.glassfish.web + jakarta.servlet.jsp.jstl + 2.0.0 + compile + + + + jakarta.servlet.jsp + jakarta.servlet.jsp-api + 3.0.0 + test + + + jakarta.servlet.jsp.jstl + jakarta.servlet.jsp.jstl-api + 2.0.0 + test + + + jakarta.servlet + * + + + + + org.apache.tomcat + tomcat-jasper + ${tomcat.version} + test + + + org.apache.tomcat + * + + + + + org.apache.tomcat + tomcat-jasper-el + ${tomcat.version} + test + + + org.apache.tomcat + * + + + + + + org.slf4j + jcl-over-slf4j + runtime + + + + org.apache.meecrowave + meecrowave-core + jakarta + ${meecrowave.version} + test + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + default-war + + war + + process-test-classes + + + + + + + diff --git a/samples/web-jakarta/src/main/resources/META-INF/NOTICE b/samples/web-jakarta/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..9d26a95ffb --- /dev/null +++ b/samples/web-jakarta/src/main/resources/META-INF/NOTICE @@ -0,0 +1,15 @@ +Apache Shiro +Copyright 2008-2020 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +The implementation for org.apache.shiro.util.SoftHashMap is based +on initial ideas from Dr. Heinz Kabutz's publicly posted version +available at http://www.javaspecialists.eu/archive/Issue015.html, +with continued modifications. + +Certain parts (StringUtils, IpAddressMatcher, etc.) of the source +code for this product was copied for simplicity and to reduce +dependencies from the source code developed by the Spring Framework +Project (http://www.springframework.org). diff --git a/samples/web-jakarta/src/main/resources/log4j2.xml b/samples/web-jakarta/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..a91b7f33e4 --- /dev/null +++ b/samples/web-jakarta/src/main/resources/log4j2.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/web-jakarta/src/main/webapp/WEB-INF/shiro.ini b/samples/web-jakarta/src/main/webapp/WEB-INF/shiro.ini new file mode 100644 index 0000000000..1e3885ac06 --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/WEB-INF/shiro.ini @@ -0,0 +1,63 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# INI configuration is very powerful and flexible, while still remaining succinct. +# Please http://shiro.apache.org/configuration.html and +# http://shiro.apache.org/web.html for more. + +[main] +listener = org.apache.shiro.config.event.LoggingBeanEventListener + +shiro.loginUrl = /login.jsp +shiro.postOnlyLogout = true + +sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager +sessionManager.sessionIdCookie.sameSite = NONE + +securityManager.sessionManager = $sessionManager +securityManager.sessionManager.sessionIdUrlRewritingEnabled = false + + +# We need to set the cipherKey, if you want the rememberMe cookie to work after restarting or on multiple nodes. +# YOU MUST SET THIS TO A UNIQUE STRING +securityManager.rememberMeManager.cipherKey = kPH+bIxk5D2deZiIxcaaaA== + +[users] +# format: username = password, role1, role2, ..., roleN +root = secret,admin +guest = guest,guest +presidentskroob = 12345,president +darkhelmet = ludicrousspeed,darklord,schwartz +lonestarr = vespa,goodguy,schwartz + +[roles] +# format: roleName = permission1, permission2, ..., permissionN +admin = * +schwartz = lightsaber:* +goodguy = winnebago:drive:eagle5 + +[urls] +# The /login.jsp is not restricted to authenticated users (otherwise no one could log in!), but +# the 'authc' filter must still be specified for it so it can process that url's +# login submissions. It is 'smart' enough to allow those requests through as specified by the +# shiro.loginUrl above. +/login.jsp = authc +/logout = logout +/account/** = authc +/remoting/** = authc, roles[b2bClient], perms["remote:invoke:lan,wan"] + diff --git a/samples/web-jakarta/src/main/webapp/WEB-INF/web.xml b/samples/web-jakarta/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..65295aa878 --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,43 @@ + + + + + + org.apache.shiro.web.env.EnvironmentLoaderListener + + + + ShiroFilter + org.apache.shiro.web.servlet.ShiroFilter + + + + ShiroFilter + /* + + + + index.jsp + + + diff --git a/samples/web-jakarta/src/main/webapp/account/index.jsp b/samples/web-jakarta/src/main/webapp/account/index.jsp new file mode 100644 index 0000000000..82bb954948 --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/account/index.jsp @@ -0,0 +1,36 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ include file="../include.jsp" %> + + + + "/> + + + +

Users only

+ +

You are currently logged in.

+ +

">Return to the home page.

+ +

" onclick="document.getElementById('logout_form').submit();return false;">Log out.

+
" method="post">
+ + diff --git a/samples/web-jakarta/src/main/webapp/home.jsp b/samples/web-jakarta/src/main/webapp/home.jsp new file mode 100644 index 0000000000..ae46cde48b --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/home.jsp @@ -0,0 +1,69 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ include file="include.jsp" %> + + + + "/> + Apache Shiro Quickstart + + + +

Apache Shiro Quickstart

+ +

Hi Guest! + ( " onclick="document.getElementById('logout_form').submit();return false;">logout + ">Log in (sample accounts provided) ) +

+ +

Welcome to the Apache Shiro Quickstart sample application. + This page represents the home page of any web application.

+ +

Visit your ">account page.

+

If you want to access the user-only ">account page, + you will need to log-in first.

+ +

Roles

+ +

To show some taglibs, here are the roles you have and don't have. Log out and log back in under different user + accounts to see different roles.

+ +

Roles you have

+ +

+ admin
+ president
+ darklord
+ goodguy
+ schwartz
+

+ +

Roles you DON'T have

+ +

+ admin
+ president
+ darklord
+ goodguy
+ schwartz
+

+ +
" method="post">
+ + diff --git a/samples/web-jakarta/src/main/webapp/include.jsp b/samples/web-jakarta/src/main/webapp/include.jsp new file mode 100644 index 0000000000..8472daca1e --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/include.jsp @@ -0,0 +1,22 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ page import="org.apache.shiro.SecurityUtils" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> diff --git a/samples/web-jakarta/src/main/webapp/index.jsp b/samples/web-jakarta/src/main/webapp/index.jsp new file mode 100644 index 0000000000..ec60ad16c0 --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/index.jsp @@ -0,0 +1,21 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> + +<%-- Forward the user to the home page --%> + diff --git a/samples/web-jakarta/src/main/webapp/login.jsp b/samples/web-jakarta/src/main/webapp/login.jsp new file mode 100644 index 0000000000..c80ee54c8a --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/login.jsp @@ -0,0 +1,110 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ include file="include.jsp" %> + + + + "/> + + + +

Please Log in

+ + +

Here are a few sample accounts to play with in the default text-based Realm (used for this + demo and test installs only). Do you remember the movie these names came from? ;)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
UsernamePassword
rootsecret
presidentskroob12345
darkhelmetludicrousspeed
lonestarrvespa
+

+
+ +
+ + + + + + + + + + + + + + + +
Username:
Password:
Remember Me
+
+ + + diff --git a/samples/web-jakarta/src/main/webapp/logout.jsp b/samples/web-jakarta/src/main/webapp/logout.jsp new file mode 100644 index 0000000000..440ec1c09a --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/logout.jsp @@ -0,0 +1,34 @@ +<%-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --%> +<%@ include file="include.jsp" %> + + + + "/> + + + +

If you are not automatically redirected, click the 'Logout' button.

+ +
" method="post"> + +
+ + + diff --git a/samples/web-jakarta/src/main/webapp/style.css b/samples/web-jakarta/src/main/webapp/style.css new file mode 100644 index 0000000000..c3e3944cfa --- /dev/null +++ b/samples/web-jakarta/src/main/webapp/style.css @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +body { + margin: 15px 0 0 15px; + padding: 1px; /*background: #2370cf;*/ + font: 12px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; + color: #000; +} + +table, td { + font: 12px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; + color: #000; +} + +h1 { + font: 24px; +} + +img { + border: thin black solid; +} + +#contentBox { + text-align: center; + width: 50%; + margin: auto; + margin-top: 50px; + color: black; + background: #eee; + border: thick black solid; +} diff --git a/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/JakartaAbstractContainerIT.java b/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/JakartaAbstractContainerIT.java new file mode 100644 index 0000000000..949243bb1b --- /dev/null +++ b/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/JakartaAbstractContainerIT.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.shiro.test.web.jakarta; + +import org.apache.meecrowave.Meecrowave; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import java.io.File; +import java.io.FilenameFilter; + +import static org.junit.Assert.assertEquals; + +public abstract class JakartaAbstractContainerIT { + + protected static Meecrowave meecrowave; + + @BeforeClass + public static void startContainer() { + final File root = new File(getWarDir()); + try { + meecrowave = new Meecrowave(new Meecrowave.Builder().randomHttpPort()); + meecrowave.getConfiguration().addGlobalContextCustomizer(ctx -> ctx.setJarScanner(new org.apache.tomcat.util.scan.StandardJarScanner())); + meecrowave.start(); + meecrowave.deployWebapp("/", root); + } catch (final Exception e) { + e.printStackTrace(); + } + } + + protected static String getBaseUri() { + return "http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/"; + } + + protected static String getWarDir() { + File[] warFiles = new File("target").listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".war"); + } + }); + + assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length); + + return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", ""); + } + + @AfterClass + public static void stopContainer() { + if (meecrowave != null) { + meecrowave.close(); + } + } +} diff --git a/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/WebContainerTest.java b/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/WebContainerTest.java new file mode 100644 index 0000000000..84ade47634 --- /dev/null +++ b/samples/web-jakarta/src/test/java/org/apache/shiro/test/web/jakarta/WebContainerTest.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.shiro.test.web.jakarta; + +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.Cookie; +import jakarta.ws.rs.core.Response; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +import java.net.URI; + +import static jakarta.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED; +import static jakarta.ws.rs.core.MediaType.TEXT_HTML_TYPE; + +public class WebContainerTest extends JakartaAbstractContainerIT { + + @Test + public void logIn() { + final Client client = ClientBuilder.newClient(); + + try { + Cookie jsessionid; + try (final Response loginPage = client.target(getBaseUri()) + .path("/login.jsp") + .request(TEXT_HTML_TYPE) + .get()) { + jsessionid = new Cookie("JSESSIONID", loginPage.getMetadata().get("Set-Cookie").get(0).toString().split(";")[0].split("=")[1]); + assertTrue(loginPage.readEntity(String.class).contains("loginform")); + } + + assertNotNull(jsessionid); + URI location; + try (final Response loginAction = client.target(getBaseUri()) + .path("/login.jsp") + .request(APPLICATION_FORM_URLENCODED) + .cookie(jsessionid) + .post(Entity.entity("username=root&password=secret&submit=Login", APPLICATION_FORM_URLENCODED))) { + assertEquals(302, loginAction.getStatus()); + location = loginAction.getLocation(); + } + + assertNotNull(location); + final String loggedPage = client.target(getBaseUri()) + .path(location.getPath()) + .request(APPLICATION_FORM_URLENCODED) + .cookie(jsessionid) + .get(String.class); + assertTrue(loggedPage.contains("Hi root!")); + } finally { + client.close(); + } + } +} diff --git a/samples/web-jakarta/src/test/resources/log4j2.xml b/samples/web-jakarta/src/test/resources/log4j2.xml new file mode 100644 index 0000000000..6fa211e03c --- /dev/null +++ b/samples/web-jakarta/src/test/resources/log4j2.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/support/guice/pom.xml b/support/guice/pom.xml index 4b83e82271..a860627dde 100644 --- a/support/guice/pom.xml +++ b/support/guice/pom.xml @@ -118,6 +118,10 @@ + + org.apache.maven.plugins + maven-shade-plugin + diff --git a/support/jaxrs/pom.xml b/support/jaxrs/pom.xml index e1513cffbe..4987dfbe94 100644 --- a/support/jaxrs/pom.xml +++ b/support/jaxrs/pom.xml @@ -74,6 +74,10 @@ + + org.apache.maven.plugins + maven-shade-plugin + diff --git a/support/spring/pom.xml b/support/spring/pom.xml index c35f41dce3..9ed00c710c 100644 --- a/support/spring/pom.xml +++ b/support/spring/pom.xml @@ -106,6 +106,10 @@ + + org.apache.maven.plugins + maven-shade-plugin + diff --git a/web/pom.xml b/web/pom.xml index 8bd9a6c669..91a8b5b026 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -106,6 +106,10 @@ + + org.apache.maven.plugins + maven-shade-plugin +