In this article we can explore the Claims Viewer Web Part.
About Web Part
I was working in a Claims enabled SharePoint Web Application where I felt the need of a Claims Viewer component which could display the current claims of the logged-in user.
You can go the following location to get the web part:
An example is displayed below.
The above component is developed as a Web Part and requires Farm Solution for deployment. The C# code runs in the server-side and renders the claims values to the output.
Following is the code which retrieves the claims.
protected void Page_Load(object sender, EventArgs e)
IClaimsPrincipal principal = Thread.CurrentPrincipal as IClaimsPrincipal;
IClaimsIdentity identity = principal.Identity as IClaimsIdentity;
IList<ClaimEntity> list = new List<ClaimEntity>();
foreach (Claim claim in identity.Claims)
ClaimType = claim.ClaimType,
Value = claim.Value,
ValueType = claim.ValueType
Once the user is logged in, the thread will contain the Claims Principal object. We can get the Claims from this object.
Each claim will have the following:
· Claim Type which is the pre-defined URL eg: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
· Claim Value which is the actual claim value eg: windows\administrator
You can use the References for articles on Installation of the Claims Viewer web part.
In this article we have explored the usage of Claims Viewer web part.