cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1522523 - in /cxf/trunk/services/sts: sts-core/src/main/java/org/apache/cxf/sts/token/delegation/ systests/basic/src/test/java/org/apache/cxf/systest/sts/common/ systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/
Date Thu, 12 Sep 2013 11:08:16 GMT
Author: coheigea
Date: Thu Sep 12 11:08:15 2013
New Revision: 1522523

URL: http://svn.apache.org/r1522523
Log:
Make it easier to relax the AudienceRestriction requirement for OnBehalfOf SAML Tokens


Conflicts:
	services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
	services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/HOKDelegationHandler.java

Removed:
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/HOKDelegationHandler.java
Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/HOKDelegationHandler.java
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-transport.xml

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/HOKDelegationHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/HOKDelegationHandler.java?rev=1522523&r1=1522522&r2=1522523&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/HOKDelegationHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/HOKDelegationHandler.java
Thu Sep 12 11:08:15 2013
@@ -60,7 +60,7 @@ public class HOKDelegationHandler extend
                 }
             }
 
-            if (appliesToAddress != null) {
+            if (isCheckAudienceRestriction() && appliesToAddress != null) {
                 List<String> addresses = getAudienceRestrictions(assertion);
                 if (!(addresses.isEmpty() || addresses.contains(appliesToAddress))) {
                     return false;
@@ -74,4 +74,4 @@ public class HOKDelegationHandler extend
         return true;
     }
     
-}
\ No newline at end of file
+}

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java?rev=1522523&r1=1522522&r2=1522523&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
(original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/delegation/SAMLDelegationHandler.java
Thu Sep 12 11:08:15 2013
@@ -44,6 +44,8 @@ public class SAMLDelegationHandler imple
     private static final Logger LOG = 
         LogUtils.getL7dLogger(SAMLDelegationHandler.class);
     
+    private boolean checkAudienceRestriction = true;
+    
     public boolean canHandleToken(ReceivedToken delegateTarget) {
         Object token = delegateTarget.getToken();
         if (token instanceof Element) {
@@ -92,7 +94,7 @@ public class SAMLDelegationHandler imple
                 }
             }
 
-            if (appliesToAddress != null) {
+            if (checkAudienceRestriction && appliesToAddress != null) {
                 List<String> addresses = getAudienceRestrictions(assertion);
                 if (!(addresses.isEmpty() || addresses.contains(appliesToAddress))) {
                     LOG.fine("The AppliesTo address " + appliesToAddress + " is not contained"
@@ -129,4 +131,16 @@ public class SAMLDelegationHandler imple
         return addresses;
     }
     
-}
\ No newline at end of file
+    public boolean isCheckAudienceRestriction() {
+        return checkAudienceRestriction;
+    }
+
+    /**
+     * Set whether to perform a check that the received AppliesTo address is contained in
the
+     * token as one of the AudienceRestriction URIs. The default is true.
+     * @param checkAudienceRestriction whether to perform an audience restriction check or
not
+     */
+    public void setCheckAudienceRestriction(boolean checkAudienceRestriction) {
+        this.checkAudienceRestriction = checkAudienceRestriction;
+    }
+}

Modified: cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-transport.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-transport.xml?rev=1522523&r1=1522522&r2=1522523&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-transport.xml
(original)
+++ cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-transport.xml
Thu Sep 12 11:08:15 2013
@@ -48,7 +48,9 @@
     </cxf:bus>
     
     <bean id="hokDelegationHandler"
-          class="org.apache.cxf.systest.sts.common.HOKDelegationHandler" />
+          class="org.apache.cxf.sts.token.delegation.HOKDelegationHandler">
+        <property name="checkAudienceRestriction" value="false"/>
+    </bean>
 
     <bean id="transportSTSProviderBean2"
         class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">



Mime
View raw message