cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Mazza (JIRA)" <>
Subject [jira] Reopened: (CXF-2894) use wsse:KeyIdentifier instead of wsse:Reference for SAML token profile
Date Sat, 24 Jul 2010 16:24:50 GMT


Glen Mazza reopened CXF-2894:

    Estimated Complexity: Moderate

This problem has popped up in another place with respect to the EncryptedData element of the
SOAP body.

Metro is expecting this (see the wsse:KeyIdentifier element under SecurityTokenReference):

   <S:Body wsu:Id="_5006">
         xmlns:ns17="" Id="_5007"
            Algorithm="" />
         <ds:KeyInfo xmlns:xsi=""
             <xenc:CipherValue>FMIK0lHrb8mzP....more encrypted data....osjRq9bIsq85gg4CJa</xenc:CipherValue>

But we are sending this instead (wsse:Reference instead of KeyIdentifier):

   <soap:Body xmlns: 
      <xenc:EncryptedData xmlns:xenc=""
         Id="EncDataId-15" Type="">
            Algorithm="" />
         <ds:KeyInfo xmlns:ds="">
                  URI="#uuid-4635d8e6-2d7a-4679-b609-782c2177b740" />
            <xenc:CipherValue>jp3E2kXyR+M....more encrypted data....ZsasdfasoD</xenc:CipherValue>

Metro is correct because of the same rationale given earlier, namely that the SAML Token Profile
does not define usage of wsse:Reference for SAML Assertions, only KeyIdentifier or EmbeddedReference.
(Section 3.3 of SAML Token Profile of 1 Dec. 2004 pdf lines 250-272.)

However, unlike my earlier fix on the Signature side it looks like a change to WSS4J will
be needed here.

In particular (untested):

1.) (in CXF) SymmeticBindingHandler.doEncryption() needs new code similar to what I added
for .doSignature():

if (!isRequestor()) {
     ... same current code...
} else { // new block added
    if (encrToken instanceof IssuedToken) {
            + WSConstants.SAML_ASSERTION_ID);

2.) (in WSS4J) Ability to handle SAML token references for encryption needs to be added:

WSSecEncryptedKey.prepareInternal() method:

switch (keyIdentifierType) { of old code...

    // add this case
        secRef.setKeyIdentifier(customTokenValueType, customTokenId);

This additional case is identical to that already present in WSS4J's WSSecSignature.prepare()

As a sanity check, can anyone see why the above case clause should be in WSS4J's WSSecSignature
but *not* in their WSSecEncryptedKey?  Hope not to embarrass myself to the WSS4J team.

> use wsse:KeyIdentifier instead of wsse:Reference for SAML token profile
> -----------------------------------------------------------------------
>                 Key: CXF-2894
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>            Reporter: Glen Mazza
>            Assignee: Glen Mazza
>         Attachments:, CXF2894Example.txt
> CXF should be using the KeyIdentifier element when identifying SAML Assertions within
wsse:SecurityTokenReference elements.
> Issue and explanation in this thread:
> Attached zip contains a Metro web service and STS (intended for standalone Tomcat deployment),
a working Metro client, and a complaining CXF one, all components Mavenized for easily compilation,
deployment, and execution.
> Instructions to host sample web service and STS from attachment:
> 1.) If necessary, to allow mvn tomcat:deploy to work in next step, set up Maven tomcat
> Pale green "Maven only" section of Step #8 here has instructions:
> 2.) From root directory, type mvn clean install tomcat:deploy
> (can call tomcat:undeploy on subsequent runs)
> Once done, confirm can see Metro web service WSDL from browser:
> https://localhost:8443/doubleit/services/doubleit?wsdl
> And confirm can see Metro STS WSDL:
> http://localhost:8080/DoubleItSTS/DoubleItSTSService?wsdl
> 3.) 
> Place the 2.2 version of jaxws-api.jar ( in the JDK_HOME/jre/lib/endorsed
> Once done, navigate to Metro client folder (/client-metro) and run mvn exec:exec
> Confirm can see output of doubled number results (10 doubled is 20).
> Wireshark results of the whole STS process w/Metro is here:
> 5.) 
> Remove 2.2 JAXWS-api.jar from endorsed folder.
> Navigate to CXF client folder (/client-cxf) and run 
> mvn clean install exec:exec (need to build here, as client-cxf is not part of parent
POM due to Metro dependencies.)
> Should see this error message:
> [INFO] Jul 14, 2010 8:00:46 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> [INFO] INFO: Creating Service {}DoubleItService
from WSDL: file:/work/workspace/DoubleItMetroWSTrust/client-cxf/src/main/resources/DoubleItService.wsdl
> [INFO] Jul 14, 2010 8:00:48 AM handleMessage
> [INFO] WARNING: Request does not contain required Security header, but it's a fault.
> ----->[INFO] Exception in thread "main" unsupported
directreference ValueType<-----
> [INFO] 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(
> [INFO] 	at $Proxy38.doubleIt(Unknown Source)
> [INFO] 	at client.WSClient.doubleIt(
> [INFO] 	at client.WSClient.main(
> [INFO] Caused by: org.apache.cxf.binding.soap.SoapFault: unsupported directreference
> [INFO] 	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(
> [INFO] 	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(
> [INFO] 	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(
> [INFO] 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> If you can use Wireshark to trace localhost calls (always can on Linux, sometimes on
Windows), can use Wireshark's Show TCP stream capability to get more of error message:

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message