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

Russell Orf edited comment on WSS-616 at 10/18/17 11:42 AM:
------------------------------------------------------------

We are using WS-SecurityPolicy. There are two policies applied to our service 
endpoint:

<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"; 
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"; 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
 wsu:Id="endpoint_HolderOfKey">
  <wsp:ExactlyOne>
    <wsp:All>
      <sp:AsymmetricBinding>
        <wsp:Policy>
          <sp:InitiatorToken>
            <wsp:Policy>
              <sp:SamlToken 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                <wsp:Policy>
                  <wsp:ExactlyOne>
                    <wsp:All>
                      <sp:WssSamlV11Token10/>
                    </wsp:All>
                    <wsp:All>
                      <sp:WssSamlV11Token11/>
                    </wsp:All>
                  </wsp:ExactlyOne>
                </wsp:Policy>
              </sp:SamlToken>
            </wsp:Policy>
          </sp:InitiatorToken>
          <sp:AlgorithmSuite>
            <wsp:Policy>
              <sp:Basic256/>
              <sp:STRTransform10/>
            </wsp:Policy>
          </sp:AlgorithmSuite>
          <sp:Layout>
            <wsp:Policy>
              <sp:Lax/>
            </wsp:Policy>
          </sp:Layout>
          <sp:IncludeTimestamp/>
          <sp:ProtectTokens/>
          <sp:OnlySignEntireHeadersAndBody/>
        </wsp:Policy>
      </sp:AsymmetricBinding>
      <wsp:ExactlyOne>
        <wsp:All>
          <sp:SignedSupportingTokens>
            <wsp:Policy>
              <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                <wsp:Policy>
                  <wsp:ExactlyOne>
                    <wsp:All>
                      <sp:WssX509V3Token10/>
                    </wsp:All>
                    <wsp:All>
                      <sp:WssX509V3Token11/>
                    </wsp:All>
                  </wsp:ExactlyOne>
                </wsp:Policy>
              </sp:X509Token>
            </wsp:Policy>
          </sp:SignedSupportingTokens>
        </wsp:All>
      </wsp:ExactlyOne>
    </wsp:All>
  </wsp:ExactlyOne>
</wsp:Policy>


<wsp:Policy xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"; 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
 
xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd";
 xmlns:env11="http://schemas.xmlsoap.org/soap/envelope"; 
xmlns:env12="http://www.w3.org/2003/05/soap-envelope"; 
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
 xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
  <sp:SignedParts>
    <sp:Body/>
  </sp:SignedParts>
  <sp:SignedElements>
    <sp:XPath>
      /env11:Header/wsse:Security/wsu:Timestamp
    </sp:XPath>
    <sp:XPath>
     /env11:Header/wsse:Security/wsu:BinarySecurityToken
    </sp:XPath>
    <sp:XPath>
     /env11:Header/wsse:Security/saml:Assertion
    </sp:XPath>
  </sp:SignedElements>
  <sp:SignedElements>
    <sp:XPath>
      /env12:Header/wsse:Security/wsu:Timestamp
    </sp:XPath>
    <sp:XPath>
     /env12:Header/wsse:Security/wsu:BinarySecurityToken
    </sp:XPath>
    <sp:XPath>
     /env12:Header/wsse:Security/saml:Assertion
    </sp:XPath>
  </sp:SignedElements>
  <sp:RequiredElements>
    <sp:XPath>wsse:Security/wsu:Timestamp</sp:XPath>
  </sp:RequiredElements>
</wsp:Policy>

Note: On deployment of our service client to tomcat, we see the WARNING: 
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.handleNoRegisteredBuilder 
No assertion builder for type 
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/}STRTransform10 
registered.



was (Author: rorf):
We are using WS-SecurityPolicy. There are two policies applied to our service 
endpoint:

<wsp:Policy wsu:Id="endpoint_HolderOfKey">
  <wsp:ExactlyOne>
    <wsp:All>
      <sp:AsymmetricBinding>
        <wsp:Policy>
          <sp:InitiatorToken>
            <wsp:Policy>
              <sp:SamlToken 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                <wsp:Policy>
                  <wsp:ExactlyOne>
                    <wsp:All>
                      <sp:WssSamlV11Token10/>
                    </wsp:All>
                    <wsp:All>
                      <sp:WssSamlV11Token11/>
                    </wsp:All>
                  </wsp:ExactlyOne>
                </wsp:Policy>
              </sp:SamlToken>
            </wsp:Policy>
          </sp:InitiatorToken>
          <sp:AlgorithmSuite>
            <wsp:Policy>
              <sp:Basic256/>
              <sp:STRTransform10/>
            </wsp:Policy>
          </sp:AlgorithmSuite>
          <sp:Layout>
            <wsp:Policy>
              <sp:Lax/>
            </wsp:Policy>
          </sp:Layout>
          <sp:IncludeTimestamp/>
          <sp:ProtectTokens/>
          <sp:OnlySignEntireHeadersAndBody/>
        </wsp:Policy>
      </sp:AsymmetricBinding>
      <wsp:ExactlyOne>
        <wsp:All>
          <sp:SignedSupportingTokens>
            <wsp:Policy>
              <sp:X509Token 
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                <wsp:Policy>
                  <wsp:ExactlyOne>
                    <wsp:All>
                      <sp:WssX509V3Token10/>
                    </wsp:All>
                    <wsp:All>
                      <sp:WssX509V3Token11/>
                    </wsp:All>
                  </wsp:ExactlyOne>
                </wsp:Policy>
              </sp:X509Token>
            </wsp:Policy>
          </sp:SignedSupportingTokens>
        </wsp:All>
      </wsp:ExactlyOne>
    </wsp:All>
  </wsp:ExactlyOne>
</wsp:Policy>


<wsp:Policy>
  <sp:SignedParts>
    <sp:Body/>
  </sp:SignedParts>
  <sp:SignedElements>
    <sp:XPath>
      /env11:Header/wsse:Security/wsu:Timestamp
    </sp:XPath>
    <sp:XPath>
     /env11:Header/wsse:Security/wsu:BinarySecurityToken
    </sp:XPath>
    <sp:XPath>
     /env11:Header/wsse:Security/saml:Assertion
    </sp:XPath>
  </sp:SignedElements>
  <sp:SignedElements>
    <sp:XPath>
      /env12:Header/wsse:Security/wsu:Timestamp
    </sp:XPath>
    <sp:XPath>
     /env12:Header/wsse:Security/wsu:BinarySecurityToken
    </sp:XPath>
    <sp:XPath>
     /env12:Header/wsse:Security/saml:Assertion
    </sp:XPath>
  </sp:SignedElements>
  <sp:RequiredElements>
    <sp:XPath>wsse:Security/wsu:Timestamp</sp:XPath>
  </sp:RequiredElements>
</wsp:Policy>

Note: On deployment of our service client to tomcat, we see the WARNING: 
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.handleNoRegisteredBuilder 
No assertion builder for type 
{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/}STRTransform10 
registered.


> 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
>
> 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