cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1491486 - /cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
Date Mon, 10 Jun 2013 15:11:10 GMT
Author: coheigea
Date: Mon Jun 10 15:11:10 2013
New Revision: 1491486

URL: http://svn.apache.org/r1491486
Log:
Don't add null resources or roles to the request

Modified:
    cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java

Modified: cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java?rev=1491486&r1=1491485&r2=1491486&view=diff
==============================================================================
--- cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
(original)
+++ cxf/trunk/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
Mon Jun 10 15:11:10 2013
@@ -95,32 +95,36 @@ public class DefaultXACMLRequestBuilder 
         attributes.add(subjectIdAttribute);
         
         for (String role : roles) {
-            AttributeValueType subjectRoleAttributeValue = 
-                RequestComponentBuilder.createAttributeValueType(role);
-            AttributeType subjectRoleAttribute = 
-                RequestComponentBuilder.createAttributeType(
-                        XACMLConstants.SUBJECT_ROLE,
-                        XACMLConstants.XS_ANY_URI,
-                        issuer,
-                        Collections.singletonList(subjectRoleAttributeValue)
-                );
-            attributes.add(subjectRoleAttribute);
+            if (role != null) {
+                AttributeValueType subjectRoleAttributeValue = 
+                    RequestComponentBuilder.createAttributeValueType(role);
+                AttributeType subjectRoleAttribute = 
+                    RequestComponentBuilder.createAttributeType(
+                            XACMLConstants.SUBJECT_ROLE,
+                            XACMLConstants.XS_ANY_URI,
+                            issuer,
+                            Collections.singletonList(subjectRoleAttributeValue)
+                    );
+                attributes.add(subjectRoleAttribute);
+            }
         }
         SubjectType subjectType = RequestComponentBuilder.createSubjectType(attributes, null);
         
         // Resource
         attributes.clear();
         for (String resource : resources) {
-            AttributeValueType resourceAttributeValue = 
-                RequestComponentBuilder.createAttributeValueType(resource);
-            AttributeType resourceAttribute = 
-                RequestComponentBuilder.createAttributeType(
-                        XACMLConstants.RESOURCE_ID,
-                        XACMLConstants.XS_STRING,
-                        null,
-                        Collections.singletonList(resourceAttributeValue)
-                );
-            attributes.add(resourceAttribute);
+            if (resource != null) {
+                AttributeValueType resourceAttributeValue = 
+                    RequestComponentBuilder.createAttributeValueType(resource);
+                AttributeType resourceAttribute = 
+                    RequestComponentBuilder.createAttributeType(
+                            XACMLConstants.RESOURCE_ID,
+                            XACMLConstants.XS_STRING,
+                            null,
+                            Collections.singletonList(resourceAttributeValue)
+                    );
+                attributes.add(resourceAttribute);
+            }
         }
         ResourceType resourceType = RequestComponentBuilder.createResourceType(attributes,
null);
         



Mime
View raw message