Export (0) Print
Expand All

<Role> Element

Specifies the role a security token is required to be a member of.

<policyDocument> Element
  <policies> Element
    <Policy> Element (WSE for Microsoft .NET) (1)
      <Confidentiality> Element
        <KeyInfo> Element (WSE for Microsoft .NET) (1)
          <SecurityToken> Element
            <Claims> Element
              <policyDocument> Element
                <policies> Element
                  <Policy> Element (WSE for Microsoft .NET) (1)
                    <Integrity> Element
                      <TokenInfo> Element
                        <SecurityToken> Element
                          <Claims> Element

<wse:Role value="Tellers" 
          wse:xmlns="http://microsoft.com/wse/2002/12/policy"/>

Attributes

Attribute Description

value

Required attribute. Specifies the role a security token is required to be a member of.

Child Elements

None

Parent Elements

Element Description

<Claims> Element

Specifies the role a security token is required to be a member of.

Use the <Role> Element element to implement role-based authorization based on policy. For more details about authorization, see Authorizing Access to a Web Service.

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 that the user is a member of the Tellers role. SOAP messages sent to the http://www.cohowinery.com/usernamesigning.asmx endpoint must 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="http://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>
  </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="http://schemas.microsoft.com/wse/2003/06/Policy"
            xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
            xmlns:wssp="http://schemas.xmlsoap.org/ws/2002/12/secext"
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"
            xmlns:wssc="http://schemas.xmlsoap.org/ws/2004/04/sc"
            xmlns:rp="http://schemas.xmlsoap.org/rp">
    <!--This policy ensures that the message is signed with 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:Claims>
              <wse:Role value="Tellers" xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy" />
            </wssp:Claims>
          </wssp:SecurityToken>
        </wssp:TokenInfo>
        <wssp:MessageParts xmlns:rp="http://schemas.xmlsoap.org/rp" Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body() wse:Timestamp() wse:Addressing()</wssp:MessageParts>
      </wssp:Integrity>
    </wsp:Policy>
  </policies>
</policyDocument>
Show:
© 2014 Microsoft