How to get the claims out of a authenticated SecurityToken
<p>I'm passing a token as a string into a SOAP service and have validated that the token is valid.  I now have a SecurityToken that in debug mode I can see all the claims and specifically the userId claim I'd like to pass into another method.  I can't seem to figure out how to get at the claims.  For now I decoded the string version of the token (the none validated string version of the token, I at least waited until after a successful validation.) Here is that code block:</p>

<pre><code>SecurityToken validatedToken = null;

if (VerifyToken(sPassword, ref response, ref validatedToken))
{
    var claimsObj = JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(claims)));
    JToken userId = claimsObj.GetValue("userId");
    return implClass.Process(userId);
}
</code></pre>

<p>How do I get the claims out of a SecurityToken?</p>

<pre><code>validatedToken.Id; // not it
validatedToken.ToClaimsPrincipal(cert); // doesn't work
</code></pre>

<p>Nothing else seemed promising to me as far as exposed properties, but since I can see the claims in the debugger I'm sure there is a way that I'm just not seeing.</p>