Skip to content

Commit

Permalink
Remove DebugProxy from ClaimsIdentity and ClaimsPrincipal (dotnet#91649)
Browse files Browse the repository at this point in the history
  • Loading branch information
jozkee authored Sep 6, 2023
1 parent 23987d2 commit 4928595
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace System.Security.Claims
/// An Identity that is represented by a set of claims.
/// </summary>
[DebuggerDisplay("{DebuggerToString(),nq}")]
[DebuggerTypeProxy(typeof(ClaimsIdentityDebugProxy))]
public class ClaimsIdentity : IIdentity
{
private enum SerializationMask
Expand Down Expand Up @@ -962,26 +961,5 @@ internal string DebuggerToString()

return debugText;
}

private sealed class ClaimsIdentityDebugProxy
{
private readonly ClaimsIdentity _identity;

public ClaimsIdentityDebugProxy(ClaimsIdentity identity)
{
_identity = identity;
}

public ClaimsIdentity? Actor => _identity.Actor;
public string? AuthenticationType => _identity.AuthenticationType;
public object? BootstrapContext => _identity.BootstrapContext;
// List type has a friendly debugger view
public List<Claim> Claims => new List<Claim>(_identity.Claims);
public bool IsAuthenticated => _identity.IsAuthenticated;
public string? Label => _identity.Label;
public string? Name => _identity.Name;
public string NameClaimType => _identity.NameClaimType;
public string RoleClaimType => _identity.RoleClaimType;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace System.Security.Claims
/// Concrete IPrincipal supporting multiple claims-based identities
/// </summary>
[DebuggerDisplay("{DebuggerToString(),nq}")]
[DebuggerTypeProxy(typeof(ClaimsPrincipalDebugProxy))]
public class ClaimsPrincipal : IPrincipal
{
private enum SerializationMask
Expand Down Expand Up @@ -594,20 +593,5 @@ private string DebuggerToString()

return $"Identities = {identitiesCount}, Claims = {claimsCount}";
}

private sealed class ClaimsPrincipalDebugProxy
{
private readonly ClaimsPrincipal _principal;

public ClaimsPrincipalDebugProxy(ClaimsPrincipal principal)
{
_principal = principal;
}

// List type has a friendly debugger view
public List<Claim> Claims => new List<Claim>(_principal.Claims);
public List<ClaimsIdentity> Identities => new List<ClaimsIdentity>(_principal.Identities);
public IIdentity? Identity => _principal.Identity;
}
}
}

0 comments on commit 4928595

Please sign in to comment.