/// An Identity that is represented by a set of claims.
/// </summary>
[DebuggerDisplay("{DebuggerToString(),nq}")]
- [DebuggerTypeProxy(typeof(ClaimsIdentityDebugProxy))]
public class ClaimsIdentity : IIdentity
{
private enum SerializationMask
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;
- }
}
}
/// Concrete IPrincipal supporting multiple claims-based identities
/// </summary>
[DebuggerDisplay("{DebuggerToString(),nq}")]
- [DebuggerTypeProxy(typeof(ClaimsPrincipalDebugProxy))]
public class ClaimsPrincipal : IPrincipal
{
private enum SerializationMask
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;
- }
}
}