cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1298913 - in /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts: claims/RequestClaim.java request/RequestParser.java
Date Fri, 09 Mar 2012 16:50:17 GMT
Author: owulff
Date: Fri Mar  9 16:50:17 2012
New Revision: 1298913

URL: http://svn.apache.org/viewvc?rev=1298913&view=rev
Log:
[CXF-4173] Support for ClaimValue element of federation claims dialect added

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/RequestClaim.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/RequestClaim.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/RequestClaim.java?rev=1298913&r1=1298912&r2=1298913&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/RequestClaim.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/claims/RequestClaim.java
Fri Mar  9 16:50:17 2012
@@ -28,6 +28,7 @@ public class RequestClaim {
 
     private URI claimType;
     private boolean optional;
+    private String claimValue;
 
     public URI getClaimType() {
         return claimType;
@@ -45,4 +46,11 @@ public class RequestClaim {
         this.optional = optional;
     }
 
+    public String getClaimValue() {
+        return claimValue;
+    }
+
+    public void setClaimValue(String claimValue) {
+        this.claimValue = claimValue;
+    }
 }

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java?rev=1298913&r1=1298912&r2=1298913&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java
Fri Mar  9 16:50:17 2012
@@ -43,6 +43,7 @@ import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -600,6 +601,37 @@ public class RequestParser {
             }
             requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional));
             return requestClaim;
+        } else if ("ClaimValue".equals(claimLocalName)) {
+            String claimTypeUri = childClaimType.getAttribute("Uri");
+            String claimTypeOptional = childClaimType.getAttribute("Optional");
+            RequestClaim requestClaim = new RequestClaim();
+            try {
+                requestClaim.setClaimType(new URI(claimTypeUri));
+            } catch (URISyntaxException e) {
+                LOG.log(
+                    Level.WARNING, 
+                    "Cannot create URI from the given ClaimTye attribute value " + claimTypeUri,
+                    e
+                );
+            }
+            
+            Node valueNode = childClaimType.getFirstChild();
+            if (valueNode != null) {
+                if ("Value".equals(valueNode.getLocalName())) {
+                    requestClaim.setClaimValue(valueNode.getTextContent());
+                } else {
+                    LOG.warning("Unsupported child element of ClaimValue element "
+                            + valueNode.getLocalName());
+                    return null;
+                }
+            } else {
+                LOG.warning("No child element of ClaimValue element available");
+                return null;
+            }
+             
+            requestClaim.setOptional(Boolean.parseBoolean(claimTypeOptional));
+            
+            return requestClaim;
         }
         
         LOG.fine("Found unknown element: " + claimLocalName + " " + claimNS);



Mime
View raw message