cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [cxf] 01/04: CXF-8091 - Update Commons JEXL
Date Wed, 14 Aug 2019 13:17:21 GMT
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 75e9ae0a7d31c14098e821e723cd766aa1e88785
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Wed Aug 14 10:18:24 2019 +0100

    CXF-8091 - Update Commons JEXL
---
 parent/pom.xml                                     |  4 ++--
 .../org/apache/cxf/rt/security/claims/Claim.java   |  5 +++++
 services/sts/sts-core/pom.xml                      |  2 +-
 .../cxf/sts/claims/mapper/JexlClaimsMapper.java    | 22 +++++++++++-----------
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index a0e2ee7..b8a2e8b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -147,7 +147,7 @@
         <cxf.jetty.osgi.version>[9.2,10)</cxf.jetty.osgi.version>
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
         <cxf.jetty9.version>9.4.19.v20190610</cxf.jetty9.version>
-        <cxf.jexl.version>2.1.1</cxf.jexl.version>
+        <cxf.jexl.version>3.1</cxf.jexl.version>
         <cxf.joda.time.version>2.9.4</cxf.joda.time.version>
         <cxf.johnzon.version>1.1.13</cxf.johnzon.version>
         <cxf.json.api.version>1.1.4</cxf.json.api.version>
@@ -2427,7 +2427,7 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.commons</groupId>
-                <artifactId>commons-jexl</artifactId>
+                <artifactId>commons-jexl3</artifactId>
                 <version>${cxf.jexl.version}</version>
             </dependency>
             <dependency>
diff --git a/rt/security/src/main/java/org/apache/cxf/rt/security/claims/Claim.java b/rt/security/src/main/java/org/apache/cxf/rt/security/claims/Claim.java
index 6c6c914..fd596ac 100644
--- a/rt/security/src/main/java/org/apache/cxf/rt/security/claims/Claim.java
+++ b/rt/security/src/main/java/org/apache/cxf/rt/security/claims/Claim.java
@@ -85,6 +85,11 @@ public class Claim implements Serializable, Cloneable {
         this.values.addAll(values);
     }
 
+    @Deprecated
+    public void setValue(Object s) {
+        addValue(s);
+    }
+
     public void addValue(Object s) {
         this.values.add(s);
     }
diff --git a/services/sts/sts-core/pom.xml b/services/sts/sts-core/pom.xml
index ba250cf..fabeae5 100644
--- a/services/sts/sts-core/pom.xml
+++ b/services/sts/sts-core/pom.xml
@@ -130,7 +130,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
-            <artifactId>commons-jexl</artifactId>
+            <artifactId>commons-jexl3</artifactId>
             <optional>true</optional>
         </dependency>
         <dependency>
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapper.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapper.java
index fbe3f2e..b01dc98 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapper.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapper.java
@@ -27,10 +27,11 @@ import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.commons.jexl2.JexlContext;
-import org.apache.commons.jexl2.JexlEngine;
-import org.apache.commons.jexl2.MapContext;
-import org.apache.commons.jexl2.Script;
+import org.apache.commons.jexl3.JexlBuilder;
+import org.apache.commons.jexl3.JexlContext;
+import org.apache.commons.jexl3.JexlEngine;
+import org.apache.commons.jexl3.JexlScript;
+import org.apache.commons.jexl3.MapContext;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.sts.claims.ClaimsMapper;
@@ -41,18 +42,17 @@ public class JexlClaimsMapper implements ClaimsMapper {
 
     private static final Logger LOG = LogUtils.getL7dLogger(JexlClaimsMapper.class);
 
-    private JexlEngine jexlEngine = new JexlEngine();
-    private Script script;
+    private JexlEngine jexlEngine;
+    private JexlScript script;
 
     public JexlClaimsMapper() {
         // jexl.setCache(512);
         // jexl.setLenient(false);
-        jexlEngine.setSilent(false);
 
         Map<String, Object> functions = new HashMap<>();
         functions.put("claims", new ClaimUtils());
         functions.put("LOG", LOG);
-        jexlEngine.setFunctions(functions);
+        jexlEngine = new JexlBuilder().silent(false).namespaces(functions).create();
     }
 
     public JexlClaimsMapper(String script) throws IOException {
@@ -72,7 +72,7 @@ public class JexlClaimsMapper implements ClaimsMapper {
         context.set("targetRealm", targetRealm);
         context.set("claimsParameters", parameters);
 
-        Script s = getScript();
+        JexlScript s = getScript();
         if (s == null) {
             LOG.warning("No claim mapping script defined");
             return new ProcessedClaimCollection(); // TODO Check if null or an exception
would be more
@@ -81,11 +81,11 @@ public class JexlClaimsMapper implements ClaimsMapper {
         return (ProcessedClaimCollection)s.execute(context);
     }
 
-    public Script getScript() {
+    public JexlScript getScript() {
         return script;
     }
 
-    public final void setScript(Script script) {
+    public final void setScript(JexlScript script) {
         this.script = script;
     }
 


Mime
View raw message