Description
In ASP.NET Core we're trying to improve the debug experience of HttpContext. One of the properties on HttpContext is the current user, represented by ClaimsPrincipal
. Today it has a relatively standard debug experience. You can see it below in screenshots. A couple of debugger display attributes should make it easier to see important information at a glance.
ClaimsIdentity:
Debugger could display "Name: {Name}, IsAuthenticated: {IsAuthenticated}, Claims count: {Claims.Count}"
ClaimsPrincipal:
The usual case for a ClaimsPrincipal
is one primary identity. In that case, it could just display information about that identity: "Identity name: {Identity.Name}, IsAuthenticated: {Identity.IsAuthenticated}, Claims count: {Identity.Claims.Count}"
If ClaimsPrincipal
has multiple identities, then it could display more general information: "Identity count: {Identities.Count}, Claims count: {Claims.Count}"
.
Also, the Claims
property should show the count. How do you customize the debug display of a yield enumerable method? Can you add a debugger display attribute to a property?
Claim:
Claim
has a ToString() already and looks good in the debugger.