Geeks With Blogs

News This is the *old* blog. The new one is at
Elton Stoneman
This is the *old* blog. The new one is at

ACS support for JWT still shows as "beta", but it meets the spec and it works nicely, so it's becoming the preferred option as SWT is losing favour. (Note that currently ACS doesn’t support JWT encryption, if you want encrypted tokens you need to go SAML).

In my last post I covered pulling claims from an ACS token without WIF, using the SWT format. The JWT format is a little more complex, but you can still inspect claims just with string manipulation.

The incoming token from ACS is still presented in the BinarySecurityToken element of the XML payload, with a TokenType of urn:ietf:params:oauth:token-type:jwt:

<t:RequestSecurityTokenResponse xmlns:t="">


    <wsu:Created xmlns:wsu="">2012-08-31T07:39:55.337Z</wsu:Created>

    <wsu:Expires xmlns:wsu="">2012-08-31T09:19:55.337Z</wsu:Expires>


  <wsp:AppliesTo xmlns:wsp="">

    <EndpointReference xmlns="">





    <wsse:BinarySecurityToken wsu:Id="_1eeb5cf4-b40b-40f2-89e0-a3343f6bd985-6A15D1EED0CDB0D8FA48C7D566232154" ValueType="urn:ietf:params:oauth:token-type:jwt" EncodingType="" xmlns:wsu="" xmlns:wsse="">[ base64string ] </wsse:BinarySecurityToken>






The token as a whole needs to be base-64 decoded. The decoded value contains a header, payload and signature, dot-separated; the parts are also base-64, but they need to be decoded using a no-padding algorithm (implementation and more details in this MSDN article on validating an Exchange 2013 identity token). The values are then in JSON; the header contains the token type and the hashing algorithm:


The payload contains the same data as in the SWT, but JSON rather than querystring format:

{"aud":"http://localhost/x.y.z" "iss":""

The signature is in the third part of the token. Unlike SWT which is fixed to HMAC-SHA-256, JWT can support other protocols (the one in use is specified as the "alg" value in the header).

How to: Validate an Exchange 2013 identity token contains an implementation of a JWT parser and validator; apart from the custom base-64 decoding part, it’s very similar to SWT extraction.

I've wrapped the basic SWT and JWT in a ClaimInspector.aspx page on gitHub here: SWT and JWT claim inspector. You can drop it into any ASP.Net site and set the URL to be your redirect page in ACS. Swap ACS to issue SWT or JWT, and using the same page you can inspect the claims that come out.

Posted on Wednesday, September 19, 2012 10:13 PM github , Azure , JSON , ACS | Back to top

Comments on this post: WIF-less claim extraction from ACS: JWT

# re: WIF-less claim extraction from ACS: JWT
Requesting Gravatar...
Thats useful, thanks - I will try it for my project aswell
Left by Sandra Partner on Oct 18, 2012 2:55 PM

Your comment:
 (will show your gravatar)

Copyright © Elton Stoneman | Powered by: | Join free