I've seen lots of examples on mapping claims attributes in SharePoint but I'm not sure how to access that claim data programmatically.

If I have mapped the claim "SpecialId" from a custom STS and the claim provides a list of the "special" Id's how do I access that list from code?

UPDATE: All of these answers were very helpful, thank you. I gave the answer to C.Marius primarily because he was first and also because it gave me a SharePoint specific code answer.

有帮助吗?

解决方案

Someone actually built a web part extracting all claims from authenticated session

http://allthingssharepoint.wordpress.com/2011/04/14/sharepoint-claims-web-part/

C:\Marius

其他提示

            IClaimsIdentity currentIdentity = System.Threading.Thread.CurrentPrincipal.Identity as IClaimsIdentity;

            //var userName = currentIdentity.Name;

            foreach (Claim claim in currentIdentity.Claims)
            {
                 // claim
            }
许可以下: CC-BY-SA归因
scroll top