2

If I look at HttpContext.Current.User.Identity.Name I get values that map to what I see in the content database in UserInfo.tp_Login.

Since I have enabled both Windows Authentication and Forms Based Authentication (claims) in my SharePoint 2010 web application I see values like the following for UserInfo.tp_Login.

<netbios_domain>\<samAccountName>
i:0#.w|<netbios_domain>\<samAccountName>
i:0#.f|<provider_name>|<claimsUserId>

For example:

MYDOMAIN\john.doe
i:0#.w|mydomain\john.doe
i:0#.f|ldapmember|john.doe@mydomain.com

Is there a good guide as to what the valid formats are here? I need to parse this information unless there is something handy function that I can use. I checked SPUtility and SPUtility.GetAccountName didn't seem to help.

I'm pretty sure that the "w" in "i:0#.w" means Windows and the "f" in "i:0#.f" means Forms, but I'm wondering if there is an enumerated list of possibilities somewhere.

1
  • The good news is that AD users apparently cannot have a "\" or a "|" in the account name, so I may just be able to use those as a delimiter. Jun 8 '11 at 2:33
2

Check out http://blog.mastykarz.nl/programmatically-converting-login-name-claim/

Yes, there's a handy function

2
  • Perfect. It doesn't quite explain all the pieces and parts, but it does provide code for parsing it. It will be interesting to see if it works with non-claims accounts (I suspect not). Jun 8 '11 at 12:21
  • I see that there is a SPClaimProviderManager.IsClaimsUser() method which should help. Jun 8 '11 at 14:11
0

There is an explanation in the whitepaper "Implementing Claims-Based Authentication with SharePoint Server 2010". You can download it here.

On page 62, "Claims Encoding", you read:

w/m/r/t/p/s = Original Issuer Type -> w = windows, m = membership, r = role, t = trusted STS, p = personal card, s= local sts claim

The rest of the string is explained too.

Update: I just found a full description on technet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.