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/09/11 12:52:27 UTC

svn commit: r1521793 - in /cxf/fediz/trunk: pom.xml services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java services/sts/src/main/webapp/WEB-INF/cxf-transport.xml services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml

Author: coheigea
Date: Wed Sep 11 10:52:27 2013
New Revision: 1521793

URL: http://svn.apache.org/r1521793
Log:
Upgrading to CXF 2.7.7-SNAPSHOT
 - Adding in FedizSAMLDelegationHandler

Added:
    cxf/fediz/trunk/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java
Modified:
    cxf/fediz/trunk/pom.xml
    cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
    cxf/fediz/trunk/services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml

Modified: cxf/fediz/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/pom.xml?rev=1521793&r1=1521792&r2=1521793&view=diff
==============================================================================
--- cxf/fediz/trunk/pom.xml (original)
+++ cxf/fediz/trunk/pom.xml Wed Sep 11 10:52:27 2013
@@ -34,7 +34,7 @@
     <properties>
         <commons.lang.version>3.0.1</commons.lang.version>
         <commons.logging.version>1.1.1</commons.logging.version>
-        <cxf.version>2.7.6</cxf.version>
+        <cxf.version>2.7.7-SNAPSHOT</cxf.version>
         <cxf.build-utils.version>2.5.0</cxf.build-utils.version>
         <ehcache.version>2.5.1</ehcache.version>
         <httpclient.version>4.2.2</httpclient.version>
@@ -48,7 +48,7 @@
         <spring.version>3.1.4.RELEASE</spring.version>
         <spring.security.version>3.1.4.RELEASE</spring.security.version>
         <tomcat.version>7.0.42</tomcat.version>
-        <wss4j.version>1.6.11</wss4j.version>
+        <wss4j.version>1.6.12</wss4j.version>
 
         <tomcat.url>http://localhost:8080/manager/text</tomcat.url>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Added: cxf/fediz/trunk/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java?rev=1521793&view=auto
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java (added)
+++ cxf/fediz/trunk/services/sts/src/main/java/org/apache/cxf/fediz/service/sts/FedizSAMLDelegationHandler.java Wed Sep 11 10:52:27 2013
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.fediz.service.sts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cxf.sts.request.ReceivedToken;
+import org.apache.cxf.sts.token.delegation.TokenDelegationParameters;
+import org.apache.cxf.sts.token.delegation.TokenDelegationResponse;
+import org.apache.ws.security.saml.ext.AssertionWrapper;
+
+/**
+ * The SAML TokenDelegationHandler implementation. It disallows ActAs or OnBehalfOf for
+ * all cases apart from the case of a Bearer SAML Token. It differs from the SAMLDelegationHandler
+ * in the STS core, in that it doesn't require that the AppliesTo address match an 
+ * AudienceRestriction address in the token.
+ */
+public class FedizSAMLDelegationHandler 
+    extends org.apache.cxf.sts.token.delegation.SAMLDelegationHandler {
+    
+    @Override
+    public boolean canHandleToken(ReceivedToken delegateTarget) {
+        System.out.println("CANHANDLE");
+        return super.canHandleToken(delegateTarget);
+    }
+    @Override
+    public TokenDelegationResponse isDelegationAllowed(TokenDelegationParameters tokenParameters) { 
+        System.out.println("HERE!");
+        return super.isDelegationAllowed(tokenParameters);
+    }
+    @Override
+    protected List<String> getAudienceRestrictions(AssertionWrapper assertion) {
+        return Collections.emptyList();
+    }
+    
+}
\ No newline at end of file

Modified: cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml?rev=1521793&r1=1521792&r2=1521793&view=diff
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml (original)
+++ cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml Wed Sep 11 10:52:27 2013
@@ -37,6 +37,9 @@
 		<property name="issueOperation" ref="transportIssueDelegate" />
 		<property name="validateOperation" ref="transportValidateDelegate" />
 	</bean>
+	
+	<bean id="samlDelegationHandler" 
+	      class="org.apache.cxf.fediz.service.sts.FedizSAMLDelegationHandler" />
 
 	<bean id="transportIssueDelegate" class="org.apache.cxf.sts.operation.TokenIssueOperation">
 		<property name="tokenProviders" ref="transportTokenProviders" />
@@ -45,6 +48,7 @@
 		<property name="stsProperties" ref="transportSTSProperties" />
 		<property name="claimsManager" ref="claimsManager" />
 		<property name="eventListener" ref="loggerListener" />
+		<property name="delegationHandlers" ref="samlDelegationHandler" />
 	</bean>
 
 	<bean id="transportValidateDelegate" class="org.apache.cxf.sts.operation.TokenValidateOperation">

Modified: cxf/fediz/trunk/services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml?rev=1521793&r1=1521792&r2=1521793&view=diff
==============================================================================
--- cxf/fediz/trunk/services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml (original)
+++ cxf/fediz/trunk/services/sts/src/realms/webapp/WEB-INF/cxf-transport.xml Wed Sep 11 10:52:27 2013
@@ -29,6 +29,9 @@
 			<cxf:logging />
 		</cxf:features>
 	</cxf:bus>
+	
+	<bean id="samlDelegationHandler" 
+	      class="org.apache.cxf.fediz.service.sts.FedizSAMLDelegationHandler" />
 
 	<bean id="transportSTSProviderBean"
 		class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">
@@ -43,6 +46,7 @@
 		<property name="claimsManager" ref="claimsManager" />
 		<property name="tokenValidators" ref="transportTokenValidators" />
 		<property name="eventListener" ref="loggerListener" />
+		<property name="delegationHandlers" ref="samlDelegationHandler" />
 	</bean>
 
 	<bean id="transportValidateDelegate" class="org.apache.cxf.sts.operation.TokenValidateOperation">