Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] Remove DebugProxy from ClaimsIdentity and ClaimsPrincipal #91680

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}
Loading