You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/06/10 17:12:57 UTC
svn commit: r1491488 -
/cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
Author: coheigea
Date: Mon Jun 10 15:12:57 2013
New Revision: 1491488
URL: http://svn.apache.org/r1491488
Log:
Merged revisions 1491486 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1491486 | coheigea | 2013-06-10 16:11:10 +0100 (Mon, 10 Jun 2013) | 2 lines
Don't add null resources or roles to the request
........
Modified:
cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
Modified: cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java?rev=1491488&r1=1491487&r2=1491488&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java (original)
+++ cxf/branches/2.7.x-fixes/rt/security/src/main/java/org/apache/cxf/rt/security/xacml/DefaultXACMLRequestBuilder.java Mon Jun 10 15:12:57 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);