title: NameClaimType in ClaimsIdentity from SAML
body: <p>I am attempting to understand the world of WIF in context of a WCF Data Service / REST / OData server.  I have a hacked up version of SelfSTS that is running inside a unit test project.  When the unit tests start, it kicks off a WCF service, which generates my SAML token.  This is the SAML token being generated:</p>
  
  <pre><code>&lt;saml:Assertion MajorVersion="1" MinorVersion="1" ... &gt;
    &lt;saml:Conditions&gt;...&lt;/saml:Conditions&gt;
    &lt;saml:AttributeStatement&gt;
      &lt;saml:Subject&gt;
        &lt;saml:NameIdentifier Format="EMAIL"&gt;4bd406bf-0cf0-4dc4-8e49-57336a479ad2&lt;/saml:NameIdentifier&gt;
        &lt;saml:SubjectConfirmation&gt;...&lt;/saml:SubjectConfirmation&gt;
      &lt;/saml:Subject&gt;
      &lt;saml:Attribute AttributeName="emailaddress" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims"&gt;
        &lt;saml:AttributeValue&gt;bob@bob.org&lt;/saml:AttributeValue&gt;
      &lt;/saml:Attribute&gt;
      &lt;saml:Attribute AttributeName="name" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims"&gt;
        &lt;saml:AttributeValue&gt;bob&lt;/saml:AttributeValue&gt;
      &lt;/saml:Attribute&gt;
    &lt;/saml:AttributeStatement&gt;
    &lt;ds:Signature&gt;...&lt;/ds:Signature&gt;
  &lt;/saml:Assertion&gt;
  </code></pre>
  
  <p>(I know the Format of my NameIdentifier isn't really EMAIL, this is something I haven't gotten to cleaning up yet.)</p>
  
  <p>Inside my actual server, I put some <a href="http://weblogs.asp.net/cibrax/archive/2010/04/15/integrating-wif-with-wcf-data-services.aspx" rel="nofollow">code</a> borrowed from Pablo Cabraro / Cibrax.  This code seems to run A-OK, although I confess that I don't understand what's happening.  I note that later in my code, when I need to check my identity, <code>Thread.CurrentPrincipal.Identity</code> is an instance of <code>Microsoft.IdentityModel.Claims.ClaimsIdentity</code>, which has a claim for all the attributes, plus a nameidentifier claim with the value in my NameIdentifier element in saml:Subject.  It also has a property <code>NameClaimType</code>, which points to "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name".  It would make more sense if <code>NameClaimType</code> mapped to nameidentifier, wouldn't it?  How do I make that happen?  Or am I expecting the wrong thing of the name claim?</p>
  
  <p>Thanks!</p>