You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/03/02 10:00:29 UTC

[1/2] tomee git commit: TOMEE-2170 tomcat requires a preemptiveAuthentication= in the context.xml

Repository: tomee
Updated Branches:
  refs/heads/master 1ef55b796 -> 12c428158


TOMEE-2170 tomcat requires a preemptiveAuthentication= in the context.xml

Not sure how this worked before. But for the LoginModules to work one
must either have a <security-constraint> in web.xml or tell Tomcat to
enable JAAS for ALL requests -> preemptiveAuthentication="true"


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d8467b26
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d8467b26
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d8467b26

Branch: refs/heads/master
Commit: d8467b265fdffb79ebc5efab8b560e5b7dca4106
Parents: 1ef55b7
Author: Mark Struberg <st...@apache.org>
Authored: Mon Feb 19 13:22:08 2018 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Thu Mar 1 23:03:04 2018 +0000

----------------------------------------------------------------------
 tomee/tomee-webaccess/src/test/resources/test/context.xml  | 2 +-
 tomee/tomee-webaccess/src/test/resources/test/login.config | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d8467b26/tomee/tomee-webaccess/src/test/resources/test/context.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-webaccess/src/test/resources/test/context.xml b/tomee/tomee-webaccess/src/test/resources/test/context.xml
index 9cecec6..e457304 100644
--- a/tomee/tomee-webaccess/src/test/resources/test/context.xml
+++ b/tomee/tomee-webaccess/src/test/resources/test/context.xml
@@ -16,7 +16,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<Context antiJARLocking="true" path="/webaccess">
+<Context antiJARLocking="true" path="/webaccess" preemptiveAuthentication="true">
   <Realm className="org.apache.catalina.realm.JAASRealm" appName="ScriptLogin"
          userClassNames="org.apache.openejb.core.security.jaas.UserPrincipal"
          roleClassNames="org.apache.openejb.core.security.jaas.GroupPrincipal">

http://git-wip-us.apache.org/repos/asf/tomee/blob/d8467b26/tomee/tomee-webaccess/src/test/resources/test/login.config
----------------------------------------------------------------------
diff --git a/tomee/tomee-webaccess/src/test/resources/test/login.config b/tomee/tomee-webaccess/src/test/resources/test/login.config
index 1a475e7..aa5b229 100644
--- a/tomee/tomee-webaccess/src/test/resources/test/login.config
+++ b/tomee/tomee-webaccess/src/test/resources/test/login.config
@@ -1,5 +1,5 @@
 ScriptLogin {
     org.apache.openejb.core.security.jaas.ScriptLoginModule required
-    	engineName="js"
-    	scriptURI="loginScript.js";
+        engineName="js"
+        scriptURI="loginScript.js";
 };


[2/2] tomee git commit: adopting ManagedExecutorServiceGetPrincipalInTaskTest to tc9

Posted by jg...@apache.org.
adopting ManagedExecutorServiceGetPrincipalInTaskTest to tc9

tomcat9 is a bit more strict it seems


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/12c42815
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/12c42815
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/12c42815

Branch: refs/heads/master
Commit: 12c4281580845ae0b488d2aab0de5e2cf504c96a
Parents: d8467b2
Author: Mark Struberg <st...@apache.org>
Authored: Thu Feb 15 21:40:48 2018 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Thu Mar 1 23:03:19 2018 +0000

----------------------------------------------------------------------
 ...edExecutorServiceGetPrincipalInTaskTest.java | 11 +++--
 .../src/test/resources/managed/web.xml          | 49 ++++++++++++++++++++
 2 files changed, 56 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/12c42815/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java b/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java
index 789aeda..d44d4b9 100644
--- a/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java
+++ b/arquillian/arquillian-tomee-remote/src/test/java/org/apache/openejb/arquillian/ManagedExecutorServiceGetPrincipalInTaskTest.java
@@ -26,11 +26,11 @@ import org.jboss.arquillian.test.api.ArquillianResource;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.asset.UrlAsset;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 
@@ -40,14 +40,17 @@ import static org.junit.Assert.assertEquals;
 public class ManagedExecutorServiceGetPrincipalInTaskTest {
     @Deployment(testable = false)
     public static Archive<?> app() {
+        ClassLoader cl = ManagedExecutorServiceGetPrincipalInTaskTest.class.getClassLoader();
+        URL tcUserFile = cl.getResource("managed/tomcat-users.xml");
+
         return ShrinkWrap.create(WebArchive.class, "mp.war")
             .addClasses(ConcurrencyServlet.class, User.class)
             .addAsManifestResource(new StringAsset(
                 "<Context>" +
                 "   <Realm className=\"" + MemoryRealm.class.getName() +
-                    "\" pathname=\"" +
-                    new File("src/test/resources/managed/tomcat-users.xml").getAbsolutePath() + "\" />" +
-                "</Context>"), "context.xml");
+                    "\" pathname=\""+ tcUserFile.getFile() + "\" />" +
+                "</Context>"), "context.xml")
+                .addAsWebInfResource(new UrlAsset(cl.getResource("managed/web.xml")), "web.xml");
     }
 
     @ArquillianResource

http://git-wip-us.apache.org/repos/asf/tomee/blob/12c42815/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml b/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml
new file mode 100644
index 0000000..1c6fb24
--- /dev/null
+++ b/arquillian/arquillian-tomee-remote/src/test/resources/managed/web.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>PropertiesLoginModule</realm-name>
+  </login-config>
+
+  <security-constraint>
+    <web-resource-collection>
+      <web-resource-name>Secured REST Service with JAAS</web-resource-name>
+      <url-pattern>/rest/*</url-pattern>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>*</role-name>
+      <!-- we'll use JAAS so don't filter too much here -->
+    </auth-constraint>
+    <user-data-constraint>
+      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+    </user-data-constraint>
+  </security-constraint>
+
+  <security-role>
+    <role-name>admin</role-name>
+  </security-role>
+  <security-role>
+    <role-name>superUser</role-name>
+  </security-role>
+</web-app>