Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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 :)

Maybe this could be useful:

SPUser user = ...;
SPClaim claim = SPClaimProviderManager.Local.ConvertSPUserToClaim(user);
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top