You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2020/12/10 16:13:05 UTC

[cxf] branch 3.4.x-fixes updated (d222091 -> 5ec4ef4)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a change to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from d222091  Updating Tomcat to 9.0.41
     new 122460d  Update to Jetty 9.4.35.v20201120 (#735)
     new 5ec4ef4  Recording .gitmergeinfo Changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                      |  1 +
 parent/pom.xml                                     |  2 +-
 .../systest/jaxrs/security/BookLoginModule.java    |  3 +-
 .../systest/jaxrs/security/BookLoginService.java   | 74 ++++++++++++++++++++++
 .../jaxrs_jaas_security/WEB-INF/beans.xml          |  5 ++
 5 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java


[cxf] 02/02: Recording .gitmergeinfo Changes

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 5ec4ef464fa4b01a713a0e8f8724c05f5925dfba
Author: reta <dr...@gmail.com>
AuthorDate: Thu Dec 10 11:12:40 2020 -0500

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index f1394cb..69e9a78 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -9,6 +9,7 @@ B c58d2cd38003a90608aa04e40756c042cbaf7e03
 B f5f08c838e1d52f17bcc8422fac38831a63e6e30
 M 1820f1a94b08ba840c3868ac3e1f3b7751540a08
 M 4162189dabdb22aec54dc3c5ae93cf42b0575d3d
+M 70c7d6a1e3f23522609d58b72b61c52e3cbc919a
 M 8c4f04855a5d8623daff2aa8a8856367879c624b
 M 9c17f2fb90a9929d0dc8e4f090da78547a4e7a02
 M 9df9b22a4032b19ea953600ebdfa84e8c15d2370


[cxf] 01/02: Update to Jetty 9.4.35.v20201120 (#735)

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 122460d1b2ecf406993104d4f5e0a8524b811a15
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Dec 10 11:11:52 2020 -0500

    Update to Jetty 9.4.35.v20201120 (#735)
    
    (cherry picked from commit e1237ab1f31b4b6bc601e93b8c0e4afec96668ee)
---
 parent/pom.xml                                     |  2 +-
 .../systest/jaxrs/security/BookLoginModule.java    |  3 +-
 .../systest/jaxrs/security/BookLoginService.java   | 74 ++++++++++++++++++++++
 .../jaxrs_jaas_security/WEB-INF/beans.xml          |  5 ++
 4 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 5cd8499..df50bda 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -148,7 +148,7 @@
         <cxf.jdom.version>1.0</cxf.jdom.version>
         <cxf.jettison.version>1.4.1</cxf.jettison.version>
         <cxf.jetty.osgi.version>[9.2,10)</cxf.jetty.osgi.version>
-        <cxf.jetty9.version>9.4.34.v20201102</cxf.jetty9.version>
+        <cxf.jetty9.version>9.4.35.v20201120</cxf.jetty9.version>
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
         <cxf.jexl.version>3.1</cxf.jexl.version>
         <cxf.joda.time.version>2.9.4</cxf.joda.time.version>
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
index 37f4cf7..4f843e4 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginModule.java
@@ -78,7 +78,8 @@ public class BookLoginModule implements LoginModule {
         Map<String, String> customOptions = new HashMap<>();
         customOptions.put("file", fileResource);
 
-        module.initialize(subject, handler, sharedState, customOptions);
+        // See please https://github.com/eclipse/jetty.project/issues/5486
+        BookLoginService.withInstance(() -> module.initialize(subject, handler, sharedState, customOptions));
     }
 
     public boolean login() throws LoginException {
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.java
new file mode 100644
index 0000000..cfbcce4
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookLoginService.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.cxf.systest.jaxrs.security;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.jetty.jaas.JAASLoginService;
+
+/**
+ * Since BookLoginModule delegates to PropertyFileLoginModule, the access to JAASLoginService.INSTANCE 
+ * is required 9.4.35.v20201120+ (see please https://github.com/eclipse/jetty.project/issues/5486).
+ */
+public class BookLoginService extends JAASLoginService {
+    private static JAASLoginService globalInstance;
+    private static Field instanceField;
+    
+    public BookLoginService() {
+        globalInstance = this;
+        
+        try {
+            instanceField = JAASLoginService.class.getField("INSTANCE");
+        } catch (final Exception ex) {
+            /* do nothing, older Jetty version where field is not available */
+        }
+    }
+    
+    public static void withInstance(Runnable r) {
+        final ThreadLocal<JAASLoginService> instance = getCurrentInstance();
+        boolean managed = false;
+        
+        try {
+            if (instance.get() == null) {
+                instance.set(globalInstance);
+                managed = true;
+            }
+            
+            r.run();
+        } finally {
+            if (managed) {
+                instance.remove();
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static ThreadLocal<JAASLoginService> getCurrentInstance() {
+        if (instanceField == null) {
+            return new ThreadLocal<JAASLoginService>();
+        } else {
+            try {
+                return (ThreadLocal<JAASLoginService>)instanceField.get(null);
+            } catch (final Exception ex) {
+                return new ThreadLocal<JAASLoginService>();
+            }
+        }
+    }
+}
diff --git a/systests/jaxrs/src/test/resources/jaxrs_jaas_security/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_jaas_security/WEB-INF/beans.xml
index 4846e89..73981ec 100644
--- a/systests/jaxrs/src/test/resources/jaxrs_jaas_security/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs_jaas_security/WEB-INF/beans.xml
@@ -94,5 +94,10 @@
         <entry key="getThatBook" value="ROLE_BOOK_OWNER"/>
         <entry key="getBook" value="ROLE_BOOK_OWNER"/>
     </util:map>
+    <bean id="loginService" class="org.apache.cxf.systest.jaxrs.security.BookLoginService" init-method="start">
+        <property name="name" value="BookStoreRealm"/>
+        <property name="loginModuleName" value="org.apache.cxf.systest.jaxrs.security.BookLoginModule"/>
+        <property name="configuration" ref="bookLoginConfig"/>
+    </bean>
 </beans>
 <!-- END SNIPPET: beans -->
\ No newline at end of file