cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf git commit: Allow custom JAXB Elements in an STS RST
Date Thu, 03 Aug 2017 16:55:06 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 963576b45 -> 338aaec85


Allow custom JAXB Elements in an STS RST

# Conflicts:
#	services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
#	services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java


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

Branch: refs/heads/3.1.x-fixes
Commit: ec72ff95b7062dcf991525cc19a90d5da152dba2
Parents: 963576b
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Aug 3 17:29:05 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Aug 3 17:54:53 2017 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/sts/request/RequestParser.java | 18 +++++++++++-------
 .../apache/cxf/sts/request/TokenRequirements.java | 17 +++++++++++++++--
 2 files changed, 26 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ec72ff95/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
index 2e705fd..b3d6b62 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
@@ -120,13 +120,17 @@ public class RequestParser {
                         found = parseKeyRequirements(jaxbElement, keyRequirements, messageContext,
stsProperties);
                     }
                     if (!found) {
-                        LOG.log(
-                            Level.WARNING, 
-                            "Found a JAXB object of unknown type: " + jaxbElement.getName()
-                        );
-                        throw new STSException(
-                            "An unknown element was received", STSException.BAD_REQUEST
-                        );
+                        if (allowCustomContent) {
+                            tokenRequirements.addCustomContentJAXB(jaxbElement);
+                        } else {
+                            LOG.log(
+                                Level.WARNING,
+                                "Found a JAXB object of unknown type: " + jaxbElement.getName()
+                            );
+                            throw new STSException(
+                                "An unknown element was received", STSException.BAD_REQUEST
+                            );
+                        }
                     }
                 } catch (STSException ex) {
                     LOG.log(Level.WARNING, "", ex);

http://git-wip-us.apache.org/repos/asf/cxf/blob/ec72ff95/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java
index 45eab81..32af269 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import javax.xml.bind.JAXBElement;
+
 import org.w3c.dom.Element;
 
 import org.apache.cxf.rt.security.claims.ClaimCollection;
@@ -46,7 +48,8 @@ public class TokenRequirements {
     private Renewing renewing;
     private Participants participants;
     private final List<Element> customContent = new ArrayList<>();
-    
+    private final List<JAXBElement<?>> customContentJAXB = new ArrayList<>();
+
     public Renewing getRenewing() {
         return renewing;
     }
@@ -161,4 +164,14 @@ public class TokenRequirements {
         }
     }
 
-}
\ No newline at end of file
+    public List<JAXBElement<?>> getCustomContentJAXB() {
+        return Collections.unmodifiableList(customContentJAXB);
+    }
+
+    public void addCustomContentJAXB(JAXBElement<?> jaxbElement) {
+        if (jaxbElement != null) {
+            this.customContentJAXB.add(jaxbElement);
+        }
+    }
+
+}


Mime
View raw message