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

Is it possible to read claims by using the SPUser object only? STS is used as claimsprovider.

All examples I have found use: var claimsPrincipal = Page.User as IClaimsPrincipal; claimsIdentity = (IClaimsIdentity)claimsPrincipal.Identity;

But I need the claims of any spuser not just the current.

I have verified that the FillMethod in the claimsprovider trigges by runnung EnsureUser() but I can't find a way to get hold of the users claims.

Is it possible?

share|improve this question

3 Answers 3

up vote 0 down vote accepted

Ultimately the claims are created from a source outside of Sharepoint, and the user must authenticate through that source to get their claims assigned. Sharepoint can't get the claims for users who are not currently logged in, because it can't authenticate to the STS as that user and the claims the STS gives the user could change.

share|improve this answer
    
Thank you for all replies! I have come to the same conclusion. The only claim accessible is the identity or login name. But it's strange that the EnsureUser() method on a SPWeb will trigger claims Fill metods on the STS. –  moregardh Oct 2 '12 at 16:58

have you looked at this?

SPUser spUser = web.EnsureUser(string.Format("i:0#.f|providerName|{0}", fbaUser.UserName)); spUser.Name = "FriendlyName"; spUser.Update();

How to map Claims to SPUser object?

hope it helps :)

share|improve this answer

Maybe this could be useful:

SPUser user = ...;
SPClaim claim = SPClaimProviderManager.Local.ConvertSPUserToClaim(user);
share|improve this answer
    
That will provide the single identity claim for that user, and not the full claim set. There are also bugs when using this through ADFS as noted in the comments on the MSDN page –  lgaud Oct 2 '12 at 15:15

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.