Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Kirk Liemohn Jun 8 '11 at 2:33
add comment

2 Answers

up vote 2 down vote accepted

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

Yes, there's a handy function

share|improve this answer
    
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). –  Kirk Liemohn Jun 8 '11 at 12:21
    
I see that there is a SPClaimProviderManager.IsClaimsUser() method which should help. –  Kirk Liemohn Jun 8 '11 at 14:11
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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