jmeter - WS Security for SOAP - SOAPMessage Timestamp&Token&Signature - problem with orders

Viewed 20

I have been using this WS Security for SOAP plugin in jmeter for a long time. It works properly. But I came across an interesting phenomenon about my current job. I would like to know if anyone has relevant experience on the subject!

The service we used to use as "asmx" has been changed to "svc". I'd like to test call this with a certificate. A new feature has become the technology in the meantime, so that the service also requires a timestamp in the call, which is also signed.

By setting the jmeter components provided by the wss module properly, the tags in the wssecurity header are created in the following order, depending on which is higher in the hierarchy list: Watch the timestamp!

    <soapenv:Header>
    <wsse:Security >
        <wsu:Timestamp >
            <wsu:Created></wsu:Created>
            <wsu:Expires></wsu:Expires>
        </wsu:Timestamp>
        <wsse:BinarySecurityToken>...</wsse:BinarySecurityToken>
        <ds:Signature>
            <ds:SignedInfo>
                <ds:CanonicalizationMethod >
                    <ec:InclusiveNamespaces />
                </ds:CanonicalizationMethod>
                <ds:SignatureMethod >
                <ds:Reference>
                    <ds:Transforms>
                        <ds:Transform>
                            <ec:InclusiveNamespaces/>
                        </ds:Transform>
                    </ds:Transforms>
                    <ds:DigestMethod/>
                    <ds:DigestValue>...=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>...</ds:SignatureValue>
            <ds:KeyInfo>
                <wsse:SecurityTokenReference>
                    <wsse:Reference/>
                </wsse:SecurityTokenReference>
            </ds:KeyInfo>
        </ds:Signature>
    </wsse:Security>
</soapenv:Header>...

OR

<soapenv:Header>
    <wsse:Security >
        <wsse:BinarySecurityToken>...</wsse:BinarySecurityToken>
        <ds:Signature>
            <ds:SignedInfo>
                <ds:CanonicalizationMethod >
                    <ec:InclusiveNamespaces />
                </ds:CanonicalizationMethod>
                <ds:SignatureMethod >
                <ds:Reference>
                    <ds:Transforms>
                        <ds:Transform>
                            <ec:InclusiveNamespaces/>
                        </ds:Transform>
                    </ds:Transforms>
                    <ds:DigestMethod/>
                    <ds:DigestValue>...=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>...</ds:SignatureValue>
            <ds:KeyInfo>
                <wsse:SecurityTokenReference>
                    <wsse:Reference/>
                </wsse:SecurityTokenReference>
            </ds:KeyInfo>
        </ds:Signature>
        <wsu:Timestamp >
            <wsu:Created></wsu:Created>
            <wsu:Expires></wsu:Expires>
        </wsu:Timestamp>
    </wsse:Security>
</soapenv:Header>...

However, neither order is appropriate for the service.

By tricking and rebuilding the request with string operations. The correct order would be:

    <soapenv:Header>
    <wsse:Security >
        <wsse:BinarySecurityToken>...</wsse:BinarySecurityToken>
        <wsu:Timestamp >
            <wsu:Created></wsu:Created>
            <wsu:Expires></wsu:Expires>
        </wsu:Timestamp>
        <ds:Signature>
            <ds:SignedInfo>
                <ds:CanonicalizationMethod >
                    <ec:InclusiveNamespaces />
                </ds:CanonicalizationMethod>
                <ds:SignatureMethod >
                <ds:Reference>
                    <ds:Transforms>
                        <ds:Transform>
                            <ec:InclusiveNamespaces/>
                        </ds:Transform>
                    </ds:Transforms>
                    <ds:DigestMethod/>
                    <ds:DigestValue>...=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>...</ds:SignatureValue>
            <ds:KeyInfo>
                <wsse:SecurityTokenReference>
                    <wsse:Reference/>
                </wsse:SecurityTokenReference>
            </ds:KeyInfo>
        </ds:Signature>
    </wsse:Security>
</soapenv:Header>...

However, I didn't see any way to set such an order! Does anyone have any idea how I could solve this "nicely"?

0 Answers
Related