[ 
https://issues.apache.org/jira/browse/WSS-616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16214942#comment-16214942
 ] 

Russell Orf commented on WSS-616:
---------------------------------

Omitting the SignedSupportingToken block from the policy does eliminate the 
error, however the request generated does not contain the 
wsse:SecurityTokenReference block as required by the service. Specifically, I 
need the request header to look like the below. How can I configure the policy 
to generate the SecurityTokenReference block?

{code:xml}
<env:Header>
  <wsse:Security>
    <saml:Assertion assertionID="myassertionid">
      ...
    </saml:Assertion>
    <!-- THIS IS THE BLOCK THAT'S MISSING -->
    <wsse:SecurityTokenReference wsu:Id="SAMLStringId"> 
       <wsse:KeyIdentifier>myassertionid</wsse:KeyIdentifier>
    </wsse:SecurityTokenReference>
    <dsig:Signature>
       <dsig:SignedInfo>
        ...
        <dsig:Reference URI="#SAMLStringId">
            <dsig:Transforms>
              <dsig:Transform 
Algorithm="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STRTransform";>
                <wsse:TransformationParameters 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-security-secext-1.0.xsd";>
                   <dsig:CanonicalizationMethod 
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                </wsse:TransformationParameters>
              </dsig:Transform>
            </dsig:Transforms>
            <dsig:DigestMethod 
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
            <dsig:DigestValue>ADALEI;RGLADKJA</dsig:DigestValue>
          </dsig:Reference>
          ...
        </dsig:SignedInfo>
        <dsig:SignatureValue>aldka;slasdlfkajei</dsig:SignatureValue>
        <dsig:KeyInfo>
           <wsse:SecurityTokenReference>
              <wsse:KeyIdentifier>myassertionid</wsse:KeyIdentifier>
           </wsse:SecurityTokenReference>
        </dsig:KeyInfo>
     </dsig:Signature>
  </wsse:Security>
</env:Header>
{code}


> STRTransform TransformException when manually adding SAML Assertion via 
> SAMLCallback.setAssertionElement()
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: WSS-616
>                 URL: https://issues.apache.org/jira/browse/WSS-616
>             Project: WSS4J
>          Issue Type: Bug
>          Components: WSS4J Core
>    Affects Versions: 2.1.7
>         Environment: Apache Tomcat 8.0.37
>            Reporter: Russell Orf
>            Assignee: Colm O hEigeartaigh
>              Labels: security
>         Attachments: catalina.out, service-client.war
>
>
> In Apache CXF v3.1.7, I have a JAX-WS web service client calling a service 
> that requires a HolderOfKey SAML Assertion. The assertions are from a custom 
> service that does not adhere to the WS-Trust SecureTokenService standard, so 
> I am adding them manually in a SAMLCallbackHander, using the 
> callback.setAssertionElement() method.
> When invoking the client, the WSS4J framework is unable to compute the 
> signature for the SecurityTokenReference header block, throwing the below 
> error:
> {{
> javax.xml.crypto.dsig.XMLSignatureException: 
> javax.xml.crypto.dsig.TransformException: 
> org.apache.wss4j.common.ext.WSSecurityException: Referenced token 
> "id-of-SAML-assertion" not found
> at 
> org.apache.wss4j.dom.str.STRParserUtil.getTokenElement(StrParserUtil.java:314)
> at 
> org.apache.wss4j.dom.transform.STRTransformUtil.dereferenceSTR(STRTransformUtil.java:98)
> at 
> org.apache.wss4j.dom.transform.STRTransform.transformIt(STRTransform.java:195)}}
> It appears that the SAML assertion DOM Element that is added via the 
> callback.setAssertionElement() method is not getting searched by the 
> STRParserUtil.getTokenElement() method.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org
For additional commands, e-mail: dev-h...@ws.apache.org

Reply via email to