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 2011/12/01 15:30:29 UTC
svn commit: r1209102 - in
/cxf/branches/2.4.x-fixes/systests/ws-security/src/test:
java/org/apache/cxf/systest/ws/spnego/
java/org/apache/cxf/systest/ws/spnego/server/
resources/org/apache/cxf/systest/ws/spnego/client/
resources/org/apache/cxf/systest/...
Author: coheigea
Date: Thu Dec 1 14:30:28 2011
New Revision: 1209102
URL: http://svn.apache.org/viewvc?rev=1209102&view=rev
Log:
Added a derived test for SPNEGO
Modified:
cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java
cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/server/DoubleItImpl.java
cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/client/client.xml
cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/server/server.xml
cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl
Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java?rev=1209102&r1=1209101&r2=1209102&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java Thu Dec 1 14:30:28 2011
@@ -86,6 +86,30 @@ public class SpnegoTokenTest extends Abs
assertTrue(result.equals(BigInteger.valueOf(50)));
}
+ @org.junit.Test
+ @org.junit.Ignore
+ public void testSpnegoOverSymmetricDerived() throws Exception {
+
+ if (!unrestrictedPoliciesInstalled) {
+ return;
+ }
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = SpnegoTokenTest.class.getResource("client/client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ DoubleItService service = new DoubleItService();
+
+ DoubleItPortType spnegoPort = service.getDoubleItSpnegoSymmetricDerivedPort();
+ updateAddressPort(spnegoPort, PORT);
+
+ BigInteger result = spnegoPort.doubleIt(BigInteger.valueOf(25));
+ assertTrue(result.equals(BigInteger.valueOf(50)));
+ }
+
private boolean checkUnrestrictedPoliciesInstalled() {
try {
Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/server/DoubleItImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/server/DoubleItImpl.java?rev=1209102&r1=1209101&r2=1209102&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/server/DoubleItImpl.java (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/server/DoubleItImpl.java Thu Dec 1 14:30:28 2011
@@ -20,14 +20,10 @@
package org.apache.cxf.systest.ws.spnego.server;
import java.math.BigInteger;
-import java.security.Principal;
-import javax.annotation.Resource;
import javax.jws.WebService;
-import javax.xml.ws.WebServiceContext;
import org.apache.cxf.feature.Features;
-import org.junit.Assert;
import wssec.spnego.DoubleItPortType;
@@ -37,15 +33,7 @@ import wssec.spnego.DoubleItPortType;
@Features(features = "org.apache.cxf.feature.LoggingFeature")
public class DoubleItImpl implements DoubleItPortType {
- @Resource
- WebServiceContext wsContext;
-
public java.math.BigInteger doubleIt(java.math.BigInteger numberToDouble) {
- Principal pr = wsContext.getUserPrincipal();
-
- Assert.assertNotNull("Principal must not be null", pr);
- Assert.assertNotNull("Principal.getName() must not return null", pr.getName());
-
return numberToDouble.multiply(BigInteger.valueOf(2));
}
Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/client/client.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/client/client.xml?rev=1209102&r1=1209101&r2=1209102&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/client/client.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/client/client.xml Thu Dec 1 14:30:28 2011
@@ -57,4 +57,20 @@
</jaxws:properties>
</jaxws:client>
+ <jaxws:client name="{http://WSSec/spnego}DoubleItSpnegoSymmetricDerivedPort"
+ createdFromAPI="true">
+ <jaxws:properties>
+ <entry key="ws-security.encryption.properties"
+ value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
+ <entry key="ws-security.encryption.username" value="bob"/>
+ <entry key="ws-security.kerberos.client">
+ <bean class="org.apache.cxf.ws.security.kerberos.KerberosClient">
+ <constructor-arg ref="cxf"/>
+ <property name="contextName" value="alice"/>
+ <property name="serviceName" value="bob@service.ws.apache.org"/>
+ </bean>
+ </entry>
+ </jaxws:properties>
+ </jaxws:client>
+
</beans>
Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/server/server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/server/server.xml?rev=1209102&r1=1209101&r2=1209102&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/server/server.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/spnego/server/server.xml Thu Dec 1 14:30:28 2011
@@ -46,14 +46,10 @@
</cxf:features>
</cxf:bus>
- <!-- <bean id="kerberosTicketDecoderImpl"
- class="org.apache.cxf.systest.ws.kerberos.server.KerberosTokenDecoderImpl"/>-->
-
<bean id="kerberosValidator"
class="org.apache.ws.security.validate.KerberosTokenValidator">
<property name="contextName" value="bob"/>
<property name="serviceName" value="bob@service.ws.apache.org"/>
- <!--<property name="kerberosTokenDecoder" ref="kerberosTicketDecoderImpl"/>-->
</bean>
<jaxws:endpoint
@@ -71,4 +67,19 @@
</jaxws:endpoint>
+ <jaxws:endpoint
+ id="SpnegoOverSymmetricDerived"
+ address="http://localhost:${testutil.ports.Server}/DoubleItSpnegoSymmetricDerived"
+ serviceName="s:DoubleItService"
+ endpointName="s:DoubleItSpnegoSymmetricDerivedPort"
+ xmlns:s="http://WSSec/spnego"
+ implementor="org.apache.cxf.systest.ws.spnego.server.DoubleItImpl"
+ wsdlLocation="wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl">
+
+ <jaxws:properties>
+ <entry key="ws-security.bst.validator" value-ref="kerberosValidator"/>
+ </jaxws:properties>
+
+ </jaxws:endpoint>
+
</beans>
Modified: cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl?rev=1209102&r1=1209101&r2=1209102&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl (original)
+++ cxf/branches/2.4.x-fixes/systests/ws-security/src/test/resources/wsdl_systest_wssec/spnego/DoubleItSpnego.wsdl Thu Dec 1 14:30:28 2011
@@ -94,11 +94,35 @@
</wsdl:operation>
</wsdl:binding>
+ <wsdl:binding name="DoubleItSpnegoSymmetricProtectionDerivedBinding" type="tns:DoubleItPortType">
+ <wsp:PolicyReference URI="#DoubleItSpnegoSymmetricProtectionDerivedPolicy" />
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="DoubleIt">
+ <soap:operation soapAction="" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Input_Policy"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ <wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Output_Policy"/>
+ </wsdl:output>
+ <wsdl:fault name="DoubleItFault">
+ <soap:body use="literal" name="DoubleItFault" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+
<wsdl:service name="DoubleItService">
<wsdl:port name="DoubleItSpnegoSymmetricPort"
binding="tns:DoubleItSpnegoSymmetricProtectionBinding">
<soap:address location="http://localhost:9001/DoubleItSpnegoSymmetric" />
</wsdl:port>
+ <wsdl:port name="DoubleItSpnegoSymmetricDerivedPort"
+ binding="tns:DoubleItSpnegoSymmetricProtectionDerivedBinding">
+ <soap:address location="http://localhost:9001/DoubleItSpnegoSymmetricDerived" />
+ </wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="DoubleItSpnegoSymmetricProtectionPolicy">
@@ -140,6 +164,46 @@
</wsp:ExactlyOne>
</wsp:Policy>
+ <wsp:Policy wsu:Id="DoubleItSpnegoSymmetricProtectionDerivedPolicy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SpnegoContextToken
+ sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys />
+ </wsp:Policy>
+ </sp:SpnegoContextToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic128/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11>
+ <wsp:Policy>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:MustSupportRefEncryptedKey/>
+ </wsp:Policy>
+ </sp:Wss11>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
<wsp:Policy wsu:Id="DoubleItBinding_DoubleIt_Input_Policy">
<wsp:ExactlyOne>
<wsp:All>