2 types derived from ClaimsPrincipal
System.Security.Claims (1)
System.Security.Principal.Windows (1)
295 instantiations of ClaimsPrincipal
Aspire.Dashboard (3)
Aspire.Hosting (1)
BasicTestApp (1)
BasicWebSite (1)
Certificate.Sample (1)
ClaimsTransformation (2)
CookiePolicySample (1)
Cookies (1)
CookieSample (1)
CookieSessionSample (1)
CustomAuthorizationFailureResponse (1)
CustomPolicyProvider (1)
HtmlGenerationWebSite (1)
Identity.DefaultUI.WebSite (1)
Microsoft.AspNetCore.Antiforgery.Test (20)
Microsoft.AspNetCore.Authentication (2)
Microsoft.AspNetCore.Authentication.Abstractions (1)
Microsoft.AspNetCore.Authentication.Certificate (1)
Microsoft.AspNetCore.Authentication.Cookies (3)
Microsoft.AspNetCore.Authentication.Core.Test (16)
AuthenticationServiceTests.cs (14)
91var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync("signin", new ClaimsPrincipal(), null));
92await context.SignInAsync("signin", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null);
106await context.SignInAsync("signin", new ClaimsPrincipal(), null);
107await context.SignInAsync("signin", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null);
123await context.SignInAsync("uber", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null);
124var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync("base", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null));
127await context.SignInAsync("signin", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null);
128ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync("signout", new ClaimsPrincipal(new ClaimsIdentity("whatever")), null));
170ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync(new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
189await context.SignInAsync(new ClaimsPrincipal(new ClaimsIdentity("whatever")));
207await context.SignInAsync(new ClaimsPrincipal(new ClaimsIdentity("whatever")));
225var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.SignInAsync(new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
249return Task.FromResult(new ClaimsPrincipal());
259new ClaimsPrincipal(new ClaimsIdentity("whatever")),
Microsoft.AspNetCore.Authentication.Facebook (1)
Microsoft.AspNetCore.Authentication.Google (1)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
Microsoft.AspNetCore.Authentication.Negotiate (1)
Microsoft.AspNetCore.Authentication.Negotiate.Test (1)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
Microsoft.AspNetCore.Authentication.Test (83)
CookieTests.cs (29)
110new ClaimsPrincipal(user),
117new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
264new ClaimsPrincipal(user),
477new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
518new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
549new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
577new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
614new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
652ctx.ReplacePrincipal(new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice2", "Cookies2"))));
659new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
683ctx.ReplacePrincipal(new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice2", "Cookies2"))));
692new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
735new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
791new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
850new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
896new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
948new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
1160new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))));
1299app.Run(context => context.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
1327app.Run(context => context.SignInAsync("Cookie1", new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
1356new ClaimsPrincipal(new ClaimsIdentity("whatever")))));
1378app.Map("/login", signoutApp => signoutApp.Run(context => context.SignInAsync("Cookies", new ClaimsPrincipal(new ClaimsIdentity("whatever")))));
1508new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))),
1532new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1554new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1577new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1599new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))),
1646new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
1714new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))));
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Authentication.WsFederation (1)
Microsoft.AspNetCore.Authorization.Policy (2)
Microsoft.AspNetCore.Authorization.Test (57)
Microsoft.AspNetCore.Components.Authorization.Tests (7)
Microsoft.AspNetCore.Components.Server (1)
Microsoft.AspNetCore.Components.Server.Tests (2)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Connections (2)
Microsoft.AspNetCore.Http.Connections.Tests (3)
Microsoft.AspNetCore.Http.Extensions.Tests (5)
Microsoft.AspNetCore.Http.Results.Tests (7)
Microsoft.AspNetCore.Http.Tests (2)
Microsoft.AspNetCore.Identity (2)
Microsoft.AspNetCore.Identity.InMemory.Test (1)
Microsoft.AspNetCore.Identity.Test (16)
Microsoft.AspNetCore.Mvc.Core (1)
Microsoft.AspNetCore.Mvc.Core.Test (6)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (2)
Microsoft.AspNetCore.Owin (1)
Microsoft.AspNetCore.Owin.Tests (3)
Microsoft.AspNetCore.Shared.Tests (4)
Microsoft.AspNetCore.SignalR.Core (1)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
Microsoft.AspNetCore.Tests (1)
Microsoft.Extensions.Identity.Core (1)
PathSchemeSelection (2)
SecurityWebSite (4)
StaticFilesAuth (1)
System.Security.Claims (2)
497 references to ClaimsPrincipal
Aspire.Dashboard (7)
BasicWebSite (1)
ClaimsTransformation (3)
CookiePolicySample (1)
CookieSample (1)
CustomAuthorizationFailureResponse (1)
dotnet-svcutil-lib (1)
Identity.DefaultUI.WebSite (1)
IdentitySample.ApiEndpoints (1)
Microsoft.AspNetCore.Antiforgery (5)
Microsoft.AspNetCore.Antiforgery.Test (4)
Microsoft.AspNetCore.Authentication (18)
Microsoft.AspNetCore.Authentication.Abstractions (23)
Microsoft.AspNetCore.Authentication.BearerToken (7)
Microsoft.AspNetCore.Authentication.Certificate (6)
Microsoft.AspNetCore.Authentication.Cookies (11)
Microsoft.AspNetCore.Authentication.Core (9)
Microsoft.AspNetCore.Authentication.Core.Test (8)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (1)
Microsoft.AspNetCore.Authentication.Negotiate (1)
Microsoft.AspNetCore.Authentication.OAuth (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (14)
OpenIdConnectHandler.cs (11)
161var principal = (await Context.AuthenticateAsync(Options.SignOutScheme))?.Principal;
760ClaimsPrincipal? user = null;
847ClaimsPrincipal tokenEndpointUser;
1042ClaimsPrincipal principal, AuthenticationProperties properties)
1110/// Save the tokens contained in the <see cref="OpenIdConnectMessage"/> in the <see cref="ClaimsPrincipal"/>.
1232private async Task<TokenValidatedContext> RunTokenValidatedEventAsync(OpenIdConnectMessage authorizationResponse, OpenIdConnectMessage? tokenEndpointResponse, ClaimsPrincipal user, AuthenticationProperties properties, JwtSecurityToken jwt, string? nonce)
1258private async Task<AuthorizationCodeReceivedContext> RunAuthorizationCodeReceivedEventAsync(OpenIdConnectMessage authorizationResponse, ClaimsPrincipal? user, AuthenticationProperties properties, JwtSecurityToken? jwt)
1307ClaimsPrincipal user,
1333private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(ClaimsPrincipal principal, AuthenticationProperties properties, OpenIdConnectMessage message, JsonDocument user)
1384private ClaimsPrincipal ValidateToken(string idToken, AuthenticationProperties properties, TokenValidationParameters validationParameters, out JwtSecurityToken jwt)
1404var principal = Options.SecurityTokenValidator.ValidateToken(idToken, validationParameters, out SecurityToken validatedToken);
Microsoft.AspNetCore.Authentication.Test (24)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authentication.WsFederation (2)
Microsoft.AspNetCore.Authorization (17)
AuthorizationServiceExtensions.cs (4)
27public static Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService service, ClaimsPrincipal user, object? resource, IAuthorizationRequirement requirement)
46public static Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService service, ClaimsPrincipal user, object? resource, AuthorizationPolicy policy)
64public static Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService service, ClaimsPrincipal user, AuthorizationPolicy policy)
82public static Task<AuthorizationResult> AuthorizeAsync(this IAuthorizationService service, ClaimsPrincipal user, string policyName)
Microsoft.AspNetCore.Authorization.Policy (11)
Microsoft.AspNetCore.Authorization.Test (50)
PolicyEvaluatorTests.cs (7)
171public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, IEnumerable<IAuthorizationRequirement> requirements)
174public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, string policyName)
180public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, IEnumerable<IAuthorizationRequirement> requirements)
183public Task<AuthorizationResult> AuthorizeAsync(ClaimsPrincipal user, object resource, string policyName)
198public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
207public ClaimsPrincipal Principal;
221public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
Microsoft.AspNetCore.Components.Authorization (6)
Microsoft.AspNetCore.Components.Authorization.Tests (8)
Microsoft.AspNetCore.Components.Server (4)
Microsoft.AspNetCore.Components.Server.Tests (2)
Microsoft.AspNetCore.Connections.Abstractions (2)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Abstractions (2)
Microsoft.AspNetCore.Http.Connections (7)
Microsoft.AspNetCore.Http.Connections.Tests (2)
Microsoft.AspNetCore.Http.Extensions (1)
Microsoft.AspNetCore.Http.Extensions.Tests (4)
Microsoft.AspNetCore.Http.Features (2)
Microsoft.AspNetCore.Http.Microbenchmarks (1)
Microsoft.AspNetCore.Http.Results (11)
Microsoft.AspNetCore.Http.Results.Tests (5)
Microsoft.AspNetCore.Identity (31)
Microsoft.AspNetCore.Identity.FunctionalTests (11)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
Microsoft.AspNetCore.Identity.Test (32)
SignInManagerTest.cs (19)
284It.Is<ClaimsPrincipal>(id => id.FindFirstValue(ClaimTypes.Name) == user.Id),
328It.Is<ClaimsPrincipal>(id => id.FindFirstValue(ClaimTypes.Name) == user.Id),
373var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
381It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
415var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
454var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
530var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, externalLogin ? loginProvider : null);
535It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider
673var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, externalLogin ? loginProvider : null);
678It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider
695It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
733var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, loginProvider: null);
759It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
979It.Is<ClaimsPrincipal>(id =>
1038var principal = new ClaimsPrincipal(identity);
1069var principal = new ClaimsPrincipal(identity);
1100var principal = new ClaimsPrincipal(identity);
1200var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
1266var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
Microsoft.AspNetCore.Mvc.Core (23)
Microsoft.AspNetCore.Mvc.Core.Test (6)
Microsoft.AspNetCore.Mvc.Razor (2)
Microsoft.AspNetCore.Mvc.RazorPages (10)
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OpenApi.Tests (1)
Microsoft.AspNetCore.Owin (6)
Microsoft.AspNetCore.Owin.Tests (2)
Microsoft.AspNetCore.Server.HttpSys (2)
Microsoft.AspNetCore.Server.IIS (2)
Microsoft.AspNetCore.Shared.Tests (12)
Microsoft.AspNetCore.SignalR.Core (5)
Microsoft.AspNetCore.Tests (3)
Microsoft.Extensions.Identity.Core (17)
MinimalJwtBearerSample (2)
MinimalOpenIdConnectSample (1)
mscorlib (1)
netstandard (1)
OpenIdConnectSample (1)
PathSchemeSelection (1)
ServerComparison.TestSites (2)
SocialSample (2)
System.Security.Claims (20)
WsFedSample (1)