<mappings> Element
Defines the mappings between policy assertions and endpoints.
<mappings>
<endpoint uri="http://www.cohowinery.com/usernamesigning.asmx" />
<defaultEndpoint />
</mappings>
Attributes and Elements
Attributes
None
Child Elements
Element | Description |
---|---|
Defines a mapping between a policy assertion and an endpoint. |
|
Defines the default policy for all endpoints affected by this policy file that do not have a mapping. |
Parent Elements
Element | Description |
---|---|
The root element for a policy file. |
Remarks
The <mappings> element contains zero or more <endpoint> Element elements and zero or one <defaultEndpoint> elements. Each <endpoint> element defines a mapping between an endpoint and a policy assertion. This mapping allows a policy assertion to be defined in a <Policy> Element (WSE for Microsoft .NET) (1) element, and then applied to multiple endpoints. When a <defaultEndpoint> element exists and the destination URL for a SOAP message does not match any of the endpoints specified in <endpoint> elements, the policy assertion specified in the <defaultEndpoint> element is applied. If there is no <defaultEndpoint> element and the destination URL for a SOAP message does not match any of the endpoints specified in any of the <endpoint> elements, the SOAP message is rejected.
Example
The following code example defines a policy assertion named signed-body-username
that requires the digital signing of the <Body> element, timestamp header, and all addressing headers by a UsernameToken and requires that SOAP messages sent to the http://www.cohowinery.com/usernamesigning.asmx
endpoint adhere to the policy assertion. For all other SOAP messages, the message-age-20s
policy is applied.
Note
This code example is designed to demonstrate WSE features and is not intended for production use.
<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="https://schemas.microsoft.com/wse/2003/06/Policy">
<mappings>
<endpoint uri="http://www.cohowinery.com/usernamesigning.asmx">
<defaultOperation>
<request policy="#signed-body-username" />
<response policy="" />
<fault policy="" />
</defaultOperation>
</endpoint>
<defaultEndpoint>
<defaultOperation>
<request policy="#message-age-20s" />
<response policy="" />
<fault policy="" />
</defaultOperation>
</defaultEndpoint>
</mappings>
<policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wse="https://schemas.microsoft.com/wse/2003/06/Policy"
xmlns:wsa="https://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wssp="https://schemas.xmlsoap.org/ws/2002/12/secext"
xmlns:wsp="https://schemas.xmlsoap.org/ws/2002/12/policy"
xmlns:wssc="https://schemas.xmlsoap.org/ws/2004/04/sc"
xmlns:rp="https://schemas.xmlsoap.org/rp">
<!--This policy ensures that messages are 20 seconds old or newer.-->
<wsp:Policy wsu:Id="message-age-20s">
<wssp:MessageAge wsp:Usage="wsp:Required" Age="20" />
</wsp:Policy>
<!--This policy ensures that the messages are signed using a
UsernameToken.-->
<wsp:Policy wsu:Id="signed-body-username">
<wssp:Integrity wsp:Usage="wsp:Required">
<wssp:TokenInfo>
<wssp:SecurityToken>
<wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</wssp:TokenType>
</wssp:SecurityToken>
</wssp:TokenInfo>
<wssp:MessageParts xmlns:rp="https://schemas.xmlsoap.org/rp" Dialect="https://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body() wse:Timestamp() wse:Addressing()</wssp:MessageParts>
</wssp:Integrity>
</wsp:Policy>
</policies>
</policyDocument>
See Also
Reference
<endpoint> Element
<defaultEndpoint> Element
<policyDocument> Element
<Policy> Element (WSE for Microsoft .NET) (1)