2 types derived from ClaimsPrincipal
System.Security.Claims (1)
System.Security.Principal.Windows (1)
302 instantiations of ClaimsPrincipal
Aspire.Dashboard (6)
Aspire.Hosting (1)
BasicWebSite (1)
Certificate.Sample (1)
ClaimsTransformation (2)
CookiePolicySample (1)
Cookies (1)
CookieSample (1)
CookieSessionSample (1)
CustomAuthorizationFailureResponse (1)
CustomPolicyProvider (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 (86)
CookieTests.cs (29)
167new ClaimsPrincipal(user),
174new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
321new ClaimsPrincipal(user),
534new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
575new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
606new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
634new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
671new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
709ctx.ReplacePrincipal(new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice2", "Cookies2"))));
716new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
740ctx.ReplacePrincipal(new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice2", "Cookies2"))));
749new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
792new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
848new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
907new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
953new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
1005new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies")))));
1217new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))));
1356app.Run(context => context.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
1384app.Run(context => context.SignInAsync("Cookie1", new ClaimsPrincipal(new ClaimsIdentity("whatever"))));
1413new ClaimsPrincipal(new ClaimsIdentity("whatever")))));
1435app.Map("/login", signoutApp => signoutApp.Run(context => context.SignInAsync("Cookies", new ClaimsPrincipal(new ClaimsIdentity("whatever")))));
1565new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))),
1589new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1611new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1634new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))));
1656new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", CookieAuthenticationDefaults.AuthenticationScheme))),
1703new ClaimsPrincipal(new ClaimsIdentity(new GenericIdentity("Alice", "Cookies"))),
1771new 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 (63)
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.Results.Tests (7)
Microsoft.AspNetCore.Http.Tests (2)
Microsoft.AspNetCore.Identity (3)
Microsoft.AspNetCore.Identity.InMemory.Test (1)
Microsoft.AspNetCore.Identity.Test (18)
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)
533 references to ClaimsPrincipal
Aspire.Dashboard (7)
BasicWebSite (1)
ClaimsTransformation (3)
CookiePolicySample (1)
CookieSample (1)
CustomAuthorizationFailureResponse (1)
dotnet-svcutil-lib (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;
756ClaimsPrincipal? user = null;
843ClaimsPrincipal tokenEndpointUser;
1038ClaimsPrincipal principal, AuthenticationProperties properties)
1106/// Save the tokens contained in the <see cref="OpenIdConnectMessage"/> in the <see cref="ClaimsPrincipal"/>.
1228private async Task<TokenValidatedContext> RunTokenValidatedEventAsync(OpenIdConnectMessage authorizationResponse, OpenIdConnectMessage? tokenEndpointResponse, ClaimsPrincipal user, AuthenticationProperties properties, JwtSecurityToken jwt, string? nonce)
1254private async Task<AuthorizationCodeReceivedContext> RunAuthorizationCodeReceivedEventAsync(OpenIdConnectMessage authorizationResponse, ClaimsPrincipal? user, AuthenticationProperties properties, JwtSecurityToken? jwt)
1303ClaimsPrincipal user,
1329private async Task<UserInformationReceivedContext> RunUserInformationReceivedEventAsync(ClaimsPrincipal principal, AuthenticationProperties properties, OpenIdConnectMessage message, JsonDocument user)
1380private ClaimsPrincipal ValidateToken(string idToken, AuthenticationProperties properties, TokenValidationParameters validationParameters, out JwtSecurityToken jwt)
1400var principal = Options.SecurityTokenValidator.ValidateToken(idToken, validationParameters, out SecurityToken validatedToken);
Microsoft.AspNetCore.Authentication.Test (27)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authentication.WsFederation (2)
Microsoft.AspNetCore.Authorization (21)
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 (56)
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.Features (2)
Microsoft.AspNetCore.Http.Microbenchmarks (1)
Microsoft.AspNetCore.Http.Results (11)
Microsoft.AspNetCore.Http.Results.Tests (5)
Microsoft.AspNetCore.Identity (50)
GeneratedRouteBuilderExtensions.g.cs (18)
1005var handler = Cast(del, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.TwoFactorResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::Microsoft.AspNetCore.Identity.Data.TwoFactorRequest arg1, global::System.IServiceProvider arg2) => throw null!);
1023var task = handler(ic.GetArgument<global::System.Security.Claims.ClaimsPrincipal>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Identity.Data.TwoFactorRequest>(1)!, ic.GetArgument<global::System.IServiceProvider>(2)!);
1034var claimsPrincipal_local = httpContext.User;
1062var claimsPrincipal_local = httpContext.User;
1077var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::System.Security.Claims.ClaimsPrincipal, global::Microsoft.AspNetCore.Identity.Data.TwoFactorRequest, global::System.IServiceProvider>(httpContext, claimsPrincipal_local, tfaRequest_local!, sp_local));
1088var castHandler = Cast(handler, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.TwoFactorResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::Microsoft.AspNetCore.Identity.Data.TwoFactorRequest arg1, global::System.IServiceProvider arg2) => throw null!);
1122var handler = Cast(del, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.InfoResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::System.IServiceProvider arg1) => throw null!);
1139var task = handler(ic.GetArgument<global::System.Security.Claims.ClaimsPrincipal>(0)!, ic.GetArgument<global::System.IServiceProvider>(1)!);
1150var claimsPrincipal_local = httpContext.User;
1171var claimsPrincipal_local = httpContext.User;
1179var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::System.Security.Claims.ClaimsPrincipal, global::System.IServiceProvider>(httpContext, claimsPrincipal_local, sp_local));
1190var castHandler = Cast(handler, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.InfoResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::System.IServiceProvider arg1) => throw null!);
1227var handler = Cast(del, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.InfoResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::Microsoft.AspNetCore.Identity.Data.InfoRequest arg1, global::Microsoft.AspNetCore.Http.HttpContext arg2, global::System.IServiceProvider arg3) => throw null!);
1245var task = handler(ic.GetArgument<global::System.Security.Claims.ClaimsPrincipal>(0)!, ic.GetArgument<global::Microsoft.AspNetCore.Identity.Data.InfoRequest>(1)!, ic.GetArgument<global::Microsoft.AspNetCore.Http.HttpContext>(2)!, ic.GetArgument<global::System.IServiceProvider>(3)!);
1256var claimsPrincipal_local = httpContext.User;
1285var claimsPrincipal_local = httpContext.User;
1301var result = await filteredInvocation(EndpointFilterInvocationContext.Create<global::System.Security.Claims.ClaimsPrincipal, global::Microsoft.AspNetCore.Identity.Data.InfoRequest, global::Microsoft.AspNetCore.Http.HttpContext, global::System.IServiceProvider>(httpContext, claimsPrincipal_local, infoRequest_local!, context_local, sp_local));
1312var castHandler = Cast(handler, global::System.Threading.Tasks.Task<global::Microsoft.AspNetCore.Http.HttpResults.Results<global::Microsoft.AspNetCore.Http.HttpResults.Ok<global::Microsoft.AspNetCore.Identity.Data.InfoResponse>, global::Microsoft.AspNetCore.Http.HttpResults.ValidationProblem, global::Microsoft.AspNetCore.Http.HttpResults.NotFound>> (global::System.Security.Claims.ClaimsPrincipal arg0, global::Microsoft.AspNetCore.Identity.Data.InfoRequest arg1, global::Microsoft.AspNetCore.Http.HttpContext arg2, global::System.IServiceProvider arg3) => throw null!);
Microsoft.AspNetCore.Identity.FunctionalTests (11)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
Microsoft.AspNetCore.Identity.Test (38)
SignInManagerTest.cs (24)
331It.Is<ClaimsPrincipal>(id => id.FindFirstValue(ClaimTypes.Name) == user.Id),
379It.Is<ClaimsPrincipal>(id => id.FindFirstValue(ClaimTypes.Name) == user.Id),
499It.IsAny<ClaimsPrincipal>(),
501.Callback((HttpContext context, string scheme, ClaimsPrincipal claimsPrincipal, AuthenticationProperties authenticationProperties) =>
559var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
567It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
601var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
640var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
716var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, externalLogin ? loginProvider : null);
721It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider
789auth.Setup(a => a.SignInAsync(context, IdentityConstants.ApplicationScheme, It.IsAny<ClaimsPrincipal>(), It.IsAny<AuthenticationProperties>()))
829var claimsPrincipal = new ClaimsPrincipal(id);
918var claimsPrincipal = new ClaimsPrincipal(id);
968var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, externalLogin ? loginProvider : null);
973It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider
990It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
1028var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, loginProvider: null);
1057It.Is<ClaimsPrincipal>(i => i.FindFirstValue(ClaimTypes.Name) == user.Id
1366It.Is<ClaimsPrincipal>(id =>
1425var principal = new ClaimsPrincipal(identity);
1456var principal = new ClaimsPrincipal(identity);
1487var principal = new ClaimsPrincipal(identity);
1587var id = SignInManager<PocoUser>.StoreTwoFactorInfo(user.Id, null);
1653var 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)
Microsoft.Extensions.Validation (1)
Microsoft.Extensions.Validation.Tests (1)
MinimalJwtBearerSample (2)
MinimalOpenIdConnectSample (1)
mscorlib (1)
netstandard (1)
OpenIdConnectSample (1)
PathSchemeSelection (1)
ServerComparison.TestSites (2)
SocialSample (2)
System.Security.Claims (20)
System.ServiceModel.Primitives (1)
WsFedSample (1)