<TokenType> Element

Specifies a security token type.

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

<TokenType>SecurityTokenType</TokenType>

Attributes and Elements

Attributes

None

Child Elements

None

Parent Elements

Element Description

<SecurityToken> Element

Specifies security token requirements.

Remarks

Use the <TokenType> element to specify the type of security token that must be used to sign or encrypt a SOAP message. The following table lists the types of security tokens and the corresponding values that can be specified in the <TokenType> element.

Value Description

http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3

X509SecurityToken

https://schemas.xmlsoap.org/ws/2003/12/kerberos/Kerberosv5ST

KerberosToken

https://schemas.xmlsoap.org/ws/2003/12/kerberos/Kerberosv5_AP_REQ

KerberosToken2

http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken

UsernameToken

https://schemas.xmlsoap.org/ws/2004/04/security/sc/sct

SecurityContextToken

https://schemas.xmlsoap.org/ws/2004/04/security/sc/dk

DerivedKeyToken

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 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="#message-age-20s" />
        <fault policy="#message-age-20s" />
      </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 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: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

<SecurityToken> Element

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy