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 18:49:30 UTC

[cxf] branch 3.3.x-fixes updated (0bc3595 -> 754acf4)

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

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


    from 0bc3595  Updating ActiveMQ to 5.15.14
     new 9a7b732  Update to Jetty 9.4.35.v20201120 (#735)
     new 754acf4  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                                      |  2 +
 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, 84 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.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 754acf4f5a0bafb8a9512a011c69554eaa030aa8
Author: reta <dr...@gmail.com>
AuthorDate: Thu Dec 10 13:49:12 2020 -0500

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

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 426e1bd..bf2aec6 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -537,6 +537,7 @@ M 6e828d6f0fea652231d0cdc9990169c3583ad03a
 M 6f08487b2b02d4fd4c95b232eff839c6066fa668
 M 6f79756afa8a0cf90a7132929cc387f6f1d21ba0
 M 706dd02fd37597967a10d5a5c1ad526b995f88ea
+M 70c7d6a1e3f23522609d58b72b61c52e3cbc919a
 M 727c2b8e70f6f8282ad2431703e88063f27d69c4
 M 743ef459be7a1a7d17cb3b67780daf06eb5356c2
 M 764662ff240d8f5dc09cb059d867d9e69bf761d4
@@ -613,6 +614,7 @@ M dde79e4471e12ab53dd87a0d2adee105c57b0a71
 M de221efcb5539d4b99d8948cdc37e72d8362aa6a
 M de540657667d3e787a41c1e34d045eb4b37b183e
 M de817963ee76778478413917f71aa8e62e221b11
+M e1237ab1f31b4b6bc601e93b8c0e4afec96668ee
 M e1b81269089d6e7cb53e949a9fde629d37bce421
 M e38fc4aa14d7741369de5d027b30e52def3a0549
 M e72ad770c9a8f4439b93e2c19e61c43562ac5877


[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.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 9a7b732fda75596663c6e195af796941779638fe
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 10d1d48..d1da45d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -145,7 +145,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>2.1.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 8ea15de..b61a1fb 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
@@ -83,7 +83,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