WS-Security header with Username Token not accepted at backend
search cancel

WS-Security header with Username Token not accepted at backend


Article ID: 108075


Updated On:


CA API Gateway


Trying to create a ws-security header that includes a username token with password digest to be accepted at the backend. Calls from SoapUI are accepted and calls from the Gateway are not. The only difference in the requests is that the Gateway does not have milliseconds in the time stamp. How do I add the milliseconds?


All supported versions of the API Gateway


The created time stamp in seconds is set by the Gateway which cannot be modified from outside. The Gateway is trimming the milliseconds intentionally in order for it to be compatible with all the customers. See OASIS standard doc: - Page 10, in the example created time stamp does not contain milliseconds.

To include milliseconds, please apply the XSL transformation using "Apply XSL Transformation" Assertion and include the schema below. Include this assertion soon after "Add or Remove WS-Security" assertion in the policy. 

<xsl:stylesheet version="1.0" xmlns:wsu="" xmlns:xsl=""> 
<xsl:output indent="yes" omit-xml-declaration="no"/> 
<xsl:strip-space elements="*"/> 

<xsl:template match="@*|node()"> 
<xsl:apply-templates select="@*|node()"/> 

<xsl:template match="wsu:Created|wsu:Expires"> 
<xsl:value-of select="concat(substring-before(., 'Z'), '.000Z')"/> 

This will append 000Z with the created timestamp with the request. 

Additional Information

Another way this was solved was by not using the Add Security Token Assertion with UsernameToken. Instead create the xml part using the "Generate Security Hash" Assertion.
For more information on this assertion, please visit our page on DocOps.