306 instantiations of Claim
BasicTestApp (2)
AuthTest\ServerAuthenticationStateProvider.cs (2)
29var claims = new[] { new Claim(ClaimTypes.Name, data.UserName) } 30.Concat(data.ExposedClaims.Select(c => new Claim(c.Type, c.Value)));
BasicWebSite (3)
BasicAuthenticationHandler.cs (3)
28new Claim("Manager", "yes"), 29new Claim(ClaimTypes.Role, "Administrator"), 30new Claim(ClaimTypes.NameIdentifier, "John")
Certificate.Sample (2)
Startup.cs (2)
24new Claim(ClaimTypes.NameIdentifier, context.ClientCertificate.Subject, ClaimValueTypes.String, context.Options.ClaimsIssuer), 25new Claim(ClaimTypes.Name, context.ClientCertificate.Subject, ClaimValueTypes.String, context.Options.ClaimsIssuer)
ClaimsTransformation (3)
ClaimsTransformer.cs (1)
21new Claim("Transformed", DateTime.Now.ToString(CultureInfo.InvariantCulture))
Controllers\AccountController.cs (2)
38new Claim("user", userName), 39new Claim("role", "Member")
CookiePolicySample (1)
Startup.cs (1)
43var user = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "bob") },
Cookies (2)
Controllers\AccountController.cs (2)
37new Claim("user", userName), 38new Claim("role", "Member")
CookieSample (1)
Program.cs (1)
43var user = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "bob") }, CookieAuthenticationDefaults.AuthenticationScheme));
CookieSessionSample (2)
Startup.cs (2)
36claims.Add(new Claim(ClaimTypes.Name, "bob")); 39claims.Add(new Claim(ClaimTypes.Role, "SomeRandomGroup" + i, ClaimValueTypes.String, "IssuedByBob", "OriginalIssuerJoe"));
CustomPolicyProvider (2)
Controllers\AccountController.cs (2)
31claims.Add(new Claim(ClaimTypes.Name, userName)); 34claims.Add(new Claim(ClaimTypes.DateOfBirth, birthDate));
dotnet-user-jwts (6)
Helpers\JwtIssuer.cs (6)
29identity.AddClaim(new Claim(JwtRegisteredClaimNames.Sub, options.Name)); 32identity.AddClaim(new Claim(JwtRegisteredClaimNames.Jti, id)); 36identity.AddClaims(scopesToAdd.Select(s => new Claim("scope", s))); 41identity.AddClaims(rolesToAdd.Select(r => new Claim(ClaimTypes.Role, r))); 46identity.AddClaims(claimsToAdd.Select(kvp => new Claim(kvp.Key, kvp.Value))); 55identity.AddClaims(audiences.Select(aud => new Claim(JwtRegisteredClaimNames.Aud, aud)));
HtmlGenerationWebSite (1)
Controllers\Catalog_CacheTagHelperController.cs (1)
59identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, id));
Identity.DefaultUI.WebSite (2)
Pages\Contoso\Login.cshtml.cs (1)
57new Claim(ClaimTypes.NameIdentifier, Input.Login)
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (1)
35var claims = user.Claims.Select(c => new Claim(c.ClaimType, c.ClaimValue)).ToList();
JwtSample (1)
Startup.cs (1)
79var claims = new[] { new Claim(ClaimTypes.NameIdentifier, httpContext.Request.Query["user"]) };
Microsoft.AspNetCore.Antiforgery.Test (25)
DefaultAntiforgeryTokenGeneratorTest.cs (1)
603var claim = new Claim(ClaimsIdentity.DefaultNameClaimType, identityUsername);
DefaultClaimUidExtractorTest.cs (24)
39mockIdentity.Setup(o => o.Claims).Returns(new Claim[] { new Claim(ClaimTypes.Name, "someName") }); 55identity.AddClaim(new Claim(ClaimTypes.Email, "someone@antiforgery.com")); 56identity.AddClaim(new Claim(ClaimTypes.GivenName, "some")); 57identity.AddClaim(new Claim(ClaimTypes.Surname, "one")); 58identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, string.Empty)); 84identity.AddClaim(new Claim("fooClaim", "fooClaimValue")); 85identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue")); 104identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue")); 105identity.AddClaim(new Claim("sub", "subClaimValue")); 106identity.AddClaim(new Claim(ClaimTypes.Upn, "upnClaimValue")); 125identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue")); 126identity.AddClaim(new Claim(ClaimTypes.Upn, "upnClaimValue")); 145identity.AddClaim(new Claim("fooClaim", "fooClaimValue")); 146identity.AddClaim(new Claim(ClaimTypes.Upn, "upnClaimValue")); 165identity1.AddClaim(new Claim("sub", "subClaimValue")); 167identity2.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue")); 186identity1.AddClaim(new Claim("sub", "subClaimValue")); 188identity2.AddClaim(new Claim(ClaimTypes.Email, "email@domain.com")); 190identity3.AddClaim(new Claim(ClaimTypes.Country, "countryValue")); 192identity4.AddClaim(new Claim(ClaimTypes.Name, "claimName")); 218identity1.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue")); 220identity2.AddClaim(new Claim("sub", "subClaimValue")); 240identity1.AddClaim(new Claim(ClaimTypes.Upn, "upnValue")); 242identity2.AddClaim(new Claim(ClaimTypes.NameIdentifier, "nameIdentifierValue"));
Microsoft.AspNetCore.Authentication (1)
TicketSerializer.cs (1)
236var claim = new Claim(type, value, valueType, issuer, originalIssuer, identity);
Microsoft.AspNetCore.Authentication.Certificate (9)
CertificateAuthenticationHandler.cs (9)
242claims.Add(new Claim("issuer", issuer, ClaimValueTypes.String, Options.ClaimsIssuer)); 245claims.Add(new Claim(ClaimTypes.Thumbprint, thumbprint, ClaimValueTypes.Base64Binary, Options.ClaimsIssuer)); 250claims.Add(new Claim(ClaimTypes.X500DistinguishedName, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 256claims.Add(new Claim(ClaimTypes.SerialNumber, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 262claims.Add(new Claim(ClaimTypes.Dns, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 268claims.Add(new Claim(ClaimTypes.Name, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 274claims.Add(new Claim(ClaimTypes.Email, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 280claims.Add(new Claim(ClaimTypes.Upn, value, ClaimValueTypes.String, Options.ClaimsIssuer)); 286claims.Add(new Claim(ClaimTypes.Uri, value, ClaimValueTypes.String, Options.ClaimsIssuer));
Microsoft.AspNetCore.Authentication.Cookies (2)
CookieAuthenticationHandler.cs (2)
267new[] { new Claim(SessionIdClaim, _sessionKey, ClaimValueTypes.String, Options.ClaimsIssuer) }, 351new[] { new Claim(SessionIdClaim, _sessionKey, ClaimValueTypes.String, Options.ClaimsIssuer) },
Microsoft.AspNetCore.Authentication.Core.Test (1)
AuthenticationTicketTests.cs (1)
40identity.AddClaim(new Claim("name", "value"));
Microsoft.AspNetCore.Authentication.Negotiate (2)
Internal\LdapAdapter.cs (2)
35identity.AddClaim(new Claim(identity.RoleClaimType, claim)); 84identity.AddClaim(new Claim(identity.RoleClaimType, claim));
Microsoft.AspNetCore.Authentication.OAuth (3)
CustomJsonClaimAction.cs (1)
37identity.AddClaim(new Claim(ClaimType, value, ValueType, issuer));
JsonKeyClaimAction.cs (1)
60identity.AddClaim(new Claim(ClaimType, value, ValueType, issuer));
MapAllClaimsAction.cs (1)
36identity.AddClaim(new Claim(pair.Name, claimValue, ClaimValueTypes.String, issuer));
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
UniqueJsonKeyClaimAction.cs (1)
58identity.AddClaim(new Claim(ClaimType, value, ValueType, issuer));
Microsoft.AspNetCore.Authentication.Test (69)
CertificateTests.cs (7)
583new Claim(ClaimTypes.Name, Expected, ClaimValueTypes.String, context.Options.ClaimsIssuer), 584new Claim("ValidationCount", validationCount.ToString(CultureInfo.InvariantCulture), ClaimValueTypes.String, context.Options.ClaimsIssuer) 654new Claim(ClaimTypes.Name, Expected, ClaimValueTypes.String, context.Options.ClaimsIssuer) 710new Claim(ClaimTypes.Name, Expected, ClaimValueTypes.String, context.Options.ClaimsIssuer), 711new Claim("ValidationCount", validationCount.ToString(CultureInfo.InvariantCulture), ClaimValueTypes.String, context.Options.ClaimsIssuer) 912new Claim(ClaimTypes.NameIdentifier, context.ClientCertificate.Subject, ClaimValueTypes.String, context.Options.ClaimsIssuer), 913new Claim(ClaimTypes.Name, context.ClientCertificate.Subject, ClaimValueTypes.String, context.Options.ClaimsIssuer)
ClaimActionTests.cs (4)
97identity.AddClaim(new Claim("name0", "value2")); 98identity.AddClaim(new Claim("name1", "value3")); 112identity.AddClaim(new Claim("name0", "value0")); 113identity.AddClaim(new Claim("name1", "value1"));
CookieTests.cs (7)
108user.AddClaim(new Claim("marker", "true")); 262user.AddClaim(new Claim("marker", "true")); 778id.AddClaim(new Claim("counter", "1")); 783id.AddClaim(new Claim("counter", claim.Value + "1")); 834id.AddClaim(new Claim("counter", "1")); 839id.AddClaim(new Claim("counter", claim.Value + "1")); 1786id.AddClaim(new Claim("xform", "yup"));
DynamicSchemeTests.cs (2)
119id.AddClaim(new Claim(ClaimTypes.NameIdentifier, Scheme.Name, ClaimValueTypes.String, Scheme.Name)); 122id.AddClaim(new Claim("Count", Options.Instance.Count.ToString(CultureInfo.InvariantCulture)));
GoogleTests.cs (2)
706context.Principal.AddIdentity(new ClaimsIdentity(new Claim[] { new Claim("RefreshToken", refreshToken, ClaimValueTypes.String, "Google") }, "Google")); 1137id.AddClaim(new Claim("xform", "yup"));
JwtBearerTests.cs (12)
55new Claim(ClaimTypes.NameIdentifier, "Bob") 92new Claim(ClaimTypes.NameIdentifier, "Bob") 230new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique"), 231new Claim(ClaimTypes.Email, "bob@contoso.com"), 232new Claim(ClaimsIdentity.DefaultNameClaimType, "bob") 503identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique")); 924new Claim(ClaimTypes.NameIdentifier, "Bob") 969new Claim(ClaimTypes.NameIdentifier, "Bob") 1150new Claim(ClaimTypes.NameIdentifier, "Bob le Tout Puissant"), 1151new Claim(ClaimTypes.Email, "bob@contoso.com"), 1152new Claim(ClaimsIdentity.DefaultNameClaimType, "bob"), 1281new Claim(ClaimTypes.NameIdentifier, "Bob")
JwtBearerTests_Handler.cs (12)
55new Claim(ClaimTypes.NameIdentifier, "Bob") 91new Claim(ClaimTypes.NameIdentifier, "Bob") 225new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique"), 226new Claim(ClaimTypes.Email, "bob@contoso.com"), 227new Claim(ClaimsIdentity.DefaultNameClaimType, "bob") 480identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique")); 877new Claim(ClaimTypes.NameIdentifier, "Bob") 921new Claim(ClaimTypes.NameIdentifier, "Bob") 1177new Claim(ClaimTypes.NameIdentifier, "Bob le Tout Puissant"), 1178new Claim(ClaimTypes.Email, "bob@contoso.com"), 1179new Claim(ClaimsIdentity.DefaultNameClaimType, "bob"), 1313new Claim(ClaimTypes.NameIdentifier, "Bob")
MicrosoftAccountTests.cs (1)
228context.Principal.AddIdentity(new ClaimsIdentity(new Claim[] { new Claim("RefreshToken", refreshToken, ClaimValueTypes.String, "Microsoft") }, "Microsoft"));
OpenIdConnect\OpenIdConnectEventTests.cs (3)
759new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique"), 760new Claim(ClaimTypes.Email, "bob@contoso.com"), 761new Claim(ClaimsIdentity.DefaultNameClaimType, "bob")
OpenIdConnect\OpenIdConnectEventTests_Handler.cs (3)
759new Claim(ClaimTypes.NameIdentifier, "Bob le Magnifique"), 760new Claim(ClaimTypes.Email, "bob@contoso.com"), 761new Claim(ClaimsIdentity.DefaultNameClaimType, "bob")
OpenIdConnect\OpenIdConnectTests.cs (4)
313claimsIdentity.AddClaim(new Claim("iss", "test")); 337claimsIdentity.AddClaim(new Claim("iss", "test")); 360claimsIdentity.AddClaim(new Claim("iss", "test")); 361claimsIdentity.AddClaim(new Claim("sid", "something"));
OpenIdConnect\UniqueJsonKeyClaimActionTests.cs (1)
34identity.AddClaim(new Claim("claimType", "value", "valueType"));
PolicyTests.cs (2)
375id.AddClaim(new Claim(ClaimTypes.NameIdentifier, Scheme.Name, ClaimValueTypes.String, Scheme.Name)); 425id.AddClaim(new Claim(ClaimTypes.NameIdentifier, Scheme.Name, ClaimValueTypes.String, Scheme.Name));
TestHandlers.cs (2)
40id.AddClaim(new Claim(ClaimTypes.NameIdentifier, Scheme.Name, ClaimValueTypes.String, Scheme.Name)); 72id.AddClaim(new Claim(ClaimTypes.NameIdentifier, Scheme.Name, ClaimValueTypes.String, Scheme.Name));
TicketSerializerTests.cs (1)
89var claim = new Claim("type", "value", "valueType", "issuer", "original-issuer");
WsFederation\WsFederationTest.cs (3)
335identity.AddClaim(new Claim("ReturnEndpoint", "true")); 336identity.AddClaim(new Claim("Authenticated", "true")); 337identity.AddClaim(new Claim(identity.RoleClaimType, "Guest", ClaimValueTypes.String));
WsFederation\WsFederationTest_Handler.cs (3)
331identity.AddClaim(new Claim("ReturnEndpoint", "true")); 332identity.AddClaim(new Claim("Authenticated", "true")); 333identity.AddClaim(new Claim(identity.RoleClaimType, "Guest", ClaimValueTypes.String));
Microsoft.AspNetCore.Authentication.Twitter (4)
TwitterHandler.cs (4)
109new Claim(ClaimTypes.NameIdentifier, accessToken.UserId, ClaimValueTypes.String, ClaimsIssuer), 110new Claim(ClaimTypes.Name, accessToken.ScreenName, ClaimValueTypes.String, ClaimsIssuer), 111new Claim("urn:twitter:userid", accessToken.UserId, ClaimValueTypes.String, ClaimsIssuer), 112new Claim("urn:twitter:screenname", accessToken.ScreenName, ClaimValueTypes.String, ClaimsIssuer)
Microsoft.AspNetCore.Authorization.Test (35)
AuthorizationMiddlewareTests.cs (7)
1015new Claim("Permission", "CanViewPage"), 1016new Claim(ClaimTypes.Role, "Administrator"), 1017new Claim(ClaimTypes.Role, "User"), 1018new Claim(ClaimTypes.NameIdentifier, "John")}, 1025new Claim("Permission", "CupBearer"), 1026new Claim(ClaimTypes.Role, "Token"), 1027new Claim(ClaimTypes.NameIdentifier, "John Bear")},
DefaultAuthorizationServiceTests.cs (28)
41var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("Permission", "CanViewPage") })); 62var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("Permission", "CanViewPage") }, "Basic")); 80new Claim("Permission", "CanViewPage"), 81new Claim("Permission", "CanViewAnything") 208new Claim("SomethingElse", "CanViewPage"), 230new Claim("SomethingElse", "CanViewPage"), 251new Claim("Permission", "CanViewComment"), 320new Claim("Permission", "CanViewPage"), 354new Claim(ClaimTypes.Role, "User"), 355new Claim(ClaimTypes.Role, "Administrator") 376new Claim(ClaimTypes.Role, "none"), 395new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "Name") }, "AuthType") 412new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Role, "Admin") }, "AuthType") 429new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Role, "Users") }, "AuthType")); 447new Claim(ClaimTypes.Role, "Nope"), 495new Claim(ClaimTypes.Name, "Tek"), 521new Claim(ClaimTypes.Name, "Hao"), 545identity.AddClaim(new Claim("Name", "Hao")); 567identity.AddClaim(new Claim("Role", "Hao")); 591new Claim(ClaimTypes.Name, "Name"), 732new Claim("Base", "Value"), 733new Claim("Claim", "Exists") 760new Claim("Claim", "Exists") 787new Claim("Base", "Value"), 851new Claim("SuperUser", "yes"), 915new Claim("SuperUser", "yes") 1062id.AddClaim(new Claim("1", "1")); 1063id.AddClaim(new Claim("2", "2"));
Microsoft.AspNetCore.Components.Server.Tests (1)
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (1)
219? new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, username) }, "testauth")
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionDispatcherTests.cs (4)
774context.User = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim("claim1", "claimValue") })); 3242var claims = new[] { new Claim(ClaimTypes.NameIdentifier, httpContext.Request.Query["user"]) }; 3306new Claim(ClaimTypes.NameIdentifier, context.Request.Query["user"]) 3404var claims = new[] { new Claim(ClaimTypes.NameIdentifier, httpContext.Request.Query["user"]) };
Microsoft.AspNetCore.Identity (7)
SignInManager.cs (7)
211additionalClaims.Add(new Claim(ClaimTypes.AuthenticationMethod, authenticationMethod)); 501claims.Add(new Claim("amr", "mfa")); 777identity.AddClaim(new Claim(ClaimTypes.Name, userId)); 780identity.AddClaim(new Claim(ClaimTypes.AuthenticationMethod, loginProvider)); 789rememberBrowserIdentity.AddClaim(new Claim(ClaimTypes.Name, userId)); 793rememberBrowserIdentity.AddClaim(new Claim(Options.ClaimsIdentity.SecurityStampClaimType, stamp)); 850await SignInWithClaimsAsync(user, isPersistent, new Claim[] { new Claim("amr", "pwd") });
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
RoleStore.cs (1)
341return await RoleClaims.Where(rc => rc.RoleId.Equals(role.Id)).Select(c => new Claim(c.ClaimType!, c.ClaimValue!)).ToListAsync(cancellationToken);
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (14)
SqlStoreOnlyUsersTestBase.cs (2)
149new Claim("Whatever", "Value"), 150new Claim("Whatever2", "Value2")
SqlStoreTestBase.cs (2)
255new Claim("Whatever", "Value"), 256new Claim("Whatever2", "Value2")
UserStoreWithGenericsTest.cs (10)
102Claim[] claims = { new Claim("c1", "v1", null, "i1"), new Claim("c2", "v2", null, "i2"), new Claim("c2", "v3", null, "i3") }; 132Claim[] claims = { new Claim("c", "v", null, "i1"), new Claim("c2", "v2", null, "i2"), new Claim("c2", "v3", null, "i3") }; 159IdentityResultAssert.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a", "i"))); 162Claim claim = new Claim("c", "b", "i"); 268return new Claim(ClaimType, ClaimValue, null, Issuer); 285return new Claim(ClaimType, ClaimValue, null, Issuer);
Microsoft.AspNetCore.Identity.InMemory.Test (4)
ControllerTest.cs (1)
68externalIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, externalId));
FunctionalTest.cs (1)
177newId.AddClaim(new Claim("PreviousName", c.CurrentPrincipal.Identity.Name));
InMemoryStore.cs (1)
128var claims = role.Claims.Select(c => new Claim(c.ClaimType, c.ClaimValue)).ToList();
InMemoryUserStore.cs (1)
35var claims = user.Claims.Select(c => new Claim(c.ClaimType, c.ClaimValue)).ToList();
Microsoft.AspNetCore.Identity.Specification.Tests (17)
IdentitySpecificationTestBase.cs (3)
239Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") };
UserManagerSpecificationTests.cs (14)
709Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") }; 740Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") }; 771IdentityResultAssert.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a"))); 774Claim claim = new Claim("c", "b"); 796IdentityResultAssert.IsSuccess(await manager.AddClaimAsync(user, new Claim("c", "a"))); 797IdentityResultAssert.IsSuccess(await manager.AddClaimAsync(user2, new Claim("c", "a"))); 802Claim claim = new Claim("c", "b"); 1927IdentityResultAssert.IsSuccess(await manager.AddClaimAsync(user, new Claim("foo", "bar"))); 1931Assert.Equal(3, (await manager.GetUsersForClaimAsync(new Claim("foo", "bar"))).Count); 1933Assert.Equal(0, (await manager.GetUsersForClaimAsync(new Claim("123", "456"))).Count);
Microsoft.AspNetCore.Identity.Test (35)
PrincipalExtensionsTest.cs (2)
24new Claim(ClaimTypes.NameIdentifier, "NameIdentifier", null, ExternalAuthenticationScheme), 25new Claim(ClaimTypes.Name, "Name")
SecurityStampValidatorTest.cs (7)
79id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 112id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 139id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 180tid.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 221id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 258id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); 296id.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id));
SignInManagerTest.cs (6)
215id.AddClaim(new Claim(ClaimTypes.Name, user.Id)); 611id.AddClaim(new Claim(ClaimTypes.AuthenticationMethod, loginProvider)); 791id.AddClaim(new Claim(ClaimTypes.Name, user.Id)); 1037identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "bar")); 1068identity.AddClaim(new Claim("sub", "bar")); 1099identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, "bar"));
UserClaimsPrincipalFactoryTest.cs (6)
61var userClaims = new[] { new Claim("Whatever", "Value"), new Claim("Whatever2", "Value2") }; 70var adminClaims = new[] { new Claim("AdminClaim1", "Value1"), new Claim("AdminClaim2", "Value2") }; 71var localClaims = new[] { new Claim("LocalClaim1", "Value1"), new Claim("LocalClaim2", "Value2") };
UserManagerTest.cs (14)
506var claims = new Claim[] { new Claim("1", "1"), new Claim("2", "2"), new Claim("3", "3") }; 527var claim = new Claim("1", "1"); 548var claim = new Claim("1", "1"); 549var newClaim = new Claim("1", "2"); 635var claims = new Claim[] { new Claim("1", "1"), new Claim("2", "2"), new Claim("3", "3") }; 656var claim = new Claim("1", "1"); 1055async () => await manager.AddClaimAsync(null, new Claim("a", "b"))); 1075async () => await manager.RemoveClaimAsync(null, new Claim("a", "b"))); 1085async () => await manager.ReplaceClaimAsync(null, new Claim("a", "b"), new Claim("a", "c")));
Microsoft.AspNetCore.Mvc.Core.Test (7)
Authorization\AuthorizeFilterTest.cs (7)
578new Claim("Permission", "CanViewPage"), 579new Claim(ClaimTypes.Role, "Administrator"), 580new Claim(ClaimTypes.Role, "User"), 581new Claim(ClaimTypes.NameIdentifier, "John")}, 588new Claim("Permission", "CupBearer"), 589new Claim(ClaimTypes.Role, "Token"), 590new Claim(ClaimTypes.NameIdentifier, "John Bear")},
Microsoft.AspNetCore.Mvc.TagHelpers.Test (2)
CacheTagKeyTest.cs (2)
358var identity = new ClaimsIdentity(new[] { new Claim(ClaimsIdentity.DefaultNameClaimType, "test_name") }); 405var identity = new ClaimsIdentity(new[] { new Claim(ClaimsIdentity.DefaultNameClaimType, "someuser") });
Microsoft.AspNetCore.Shared.Tests (1)
SecurityHelperTests.cs (1)
55identityNoAuthTypeWithClaim.AddClaim(new Claim("identityNoAuthTypeWithClaim", "yes"));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Startup.cs (1)
135var claims = new[] { new Claim(ClaimTypes.NameIdentifier, name) };
Microsoft.AspNetCore.SignalR.Specification.Tests (2)
src\SignalR\common\testassets\Tests.Utils\TestClient.cs (2)
53var claims = new List<Claim> { new Claim(ClaimTypes.Name, claimValue) }; 56claims.Add(new Claim(ClaimTypes.NameIdentifier, userIdentifier));
Microsoft.AspNetCore.SignalR.Tests (3)
HubConnectionHandlerTests.cs (2)
2245client.Connection.User.AddIdentity(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "name") })); 2347client.Connection.User.AddIdentity(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "name") }));
Startup.cs (1)
107var claims = new[] { new Claim(ClaimTypes.NameIdentifier, httpContext.Request.Query["user"]) };
Microsoft.AspNetCore.SignalR.Tests.Utils (2)
TestClient.cs (2)
53var claims = new List<Claim> { new Claim(ClaimTypes.Name, claimValue) }; 56claims.Add(new Claim(ClaimTypes.NameIdentifier, userIdentifier));
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
2864id.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, username));
Microsoft.Extensions.Identity.Core (5)
UserClaimsPrincipalFactory.cs (5)
78id.AddClaim(new Claim(Options.ClaimsIdentity.UserIdClaimType, userId)); 79id.AddClaim(new Claim(Options.ClaimsIdentity.UserNameClaimType, userName!)); 85id.AddClaim(new Claim(Options.ClaimsIdentity.EmailClaimType, email)); 90id.AddClaim(new Claim(Options.ClaimsIdentity.SecurityStampClaimType, 144id.AddClaim(new Claim(Options.ClaimsIdentity.RoleClaimType, roleName));
Microsoft.Extensions.Identity.Stores (2)
IdentityRoleClaim.cs (1)
41return new Claim(ClaimType!, ClaimValue!);
IdentityUserClaim.cs (1)
41return new Claim(ClaimType!, ClaimValue!);
OpenIdConnectSample (1)
Startup.cs (1)
371identity.AddClaim(new Claim(claim.Type, claim.Value, claim.ValueType, issuer, claim.OriginalIssuer, claim.Subject));
PathSchemeSelection (3)
Controllers\AccountController.cs (2)
38new Claim("user", userName), 39new Claim("role", "Member")
Startup.cs (1)
47id.AddClaim(new Claim(ClaimTypes.Name, "Hao", ClaimValueTypes.String, "Api"));
SecurityWebSite (5)
Controllers\LoginController.cs (5)
18var identity = new ClaimsIdentity(new[] { new Claim("ClaimA", "Value") }, CookieAuthenticationDefaults.AuthenticationScheme); 26var identity = new ClaimsIdentity(new[] { new Claim("ClaimA", "Value") }, CookieAuthenticationDefaults.AuthenticationScheme); 34var identity = new ClaimsIdentity(new[] { new Claim("ClaimA", "Value"), new Claim("ClaimB", "Value") }, CookieAuthenticationDefaults.AuthenticationScheme); 41var identity = new ClaimsIdentity(new[] { new Claim("ClaimA", "Value") });
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
293var claims = new[] { new Claim(ClaimTypes.NameIdentifier, "testuser") };
StaticFilesAuth (2)
Controllers\AccountController.cs (2)
37new Claim("user", userName), 38new Claim("role", "Member")
System.Security.Claims (5)
System\Security\Claims\Claim.cs (1)
395return new Claim(this, identity);
System\Security\Claims\ClaimsIdentity.cs (2)
185SafeAddClaim(new Claim(_nameClaimType, identity.Name, ClaimValueTypes.String, DefaultIssuer, DefaultIssuer, this)); 775return new Claim(reader, this);
System\Security\Claims\GenericIdentity.cs (1)
86base.AddClaim(new Claim(base.NameClaimType, m_name, ClaimValueTypes.String, ClaimsIdentity.DefaultIssuer, ClaimsIdentity.DefaultIssuer, this));
System\Security\Claims\GenericPrincipal.cs (1)
55roleClaims.Add(new Claim(claimsIdentity.RoleClaimType, role, ClaimValueTypes.String, ClaimsIdentity.DefaultIssuer, ClaimsIdentity.DefaultIssuer, claimsIdentity));
406 references to Claim
ClaimsTransformation (2)
ClaimsTransformer.cs (1)
19transformed.AddIdentity(new ClaimsIdentity(new Claim[]
Controllers\AccountController.cs (1)
36var claims = new List<Claim>
Cookies (1)
Controllers\AccountController.cs (1)
35var claims = new List<Claim>
CookieSessionSample (1)
Startup.cs (1)
35var claims = new List<Claim>(1001);
CustomPolicyProvider (2)
Authorization\MinimumAgeAuthorizationHandler.cs (1)
32var dateOfBirthClaim = context.User.FindFirst(c => c.Type == ClaimTypes.DateOfBirth);
Controllers\AccountController.cs (1)
29var claims = new List<Claim>();
Identity.DefaultUI.WebSite (10)
Pages\Contoso\Login.cshtml.cs (1)
55var identity = new ClaimsIdentity(new Claim[]
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (9)
33public Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken)) 36return Task.FromResult<IList<Claim>>(claims); 39public Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 41foreach (var claim in claims) 48public Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 59public Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 61foreach (var claim in claims) 334public Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.AspNetCore.Antiforgery (5)
Internal\DefaultClaimUidExtractor.cs (5)
55var subClaim = identity.FindFirst( 67var nameIdentifierClaim = identity.FindFirst( 79var upnClaim = identity.FindFirst( 93var allClaims = new List<Claim>(); 113var claim = allClaims[i];
Microsoft.AspNetCore.Antiforgery.Test (3)
DefaultAntiforgeryTokenGeneratorTest.cs (1)
603var claim = new Claim(ClaimsIdentity.DefaultNameClaimType, identityUsername);
DefaultClaimUidExtractorTest.cs (2)
39mockIdentity.Setup(o => o.Claims).Returns(new Claim[] { new Claim(ClaimTypes.Name, "someName") }); 71foreach (var claim in claims)
Microsoft.AspNetCore.Authentication (7)
TicketSerializer.cs (7)
92foreach (var claim in identity.Claims) 120protected virtual void WriteClaim(BinaryWriter writer, Claim claim) 197var claim = ReadClaim(reader, identity); 220/// Reads a <see cref="Claim"/> and adds it to the specified <paramref name="identity"/>. 224/// <returns>The read <see cref="Claim"/>.</returns> 225protected virtual Claim ReadClaim(BinaryReader reader, ClaimsIdentity identity) 236var claim = new Claim(type, value, valueType, issuer, originalIssuer, identity);
Microsoft.AspNetCore.Authentication.Certificate (1)
CertificateAuthenticationHandler.cs (1)
239var claims = new List<Claim>();
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieAuthenticationHandler.cs (1)
166var claim = ticket.Principal.Claims.FirstOrDefault(c => c.Type.Equals(SessionIdClaim));
Microsoft.AspNetCore.Authentication.OAuth (3)
ClaimAction.cs (2)
26/// Gets the value to use for <see cref="Claim.Value"/>when creating a Claim. 31/// Gets the value to use for <see cref="Claim.ValueType"/> when creating a Claim.
DeleteClaimAction.cs (1)
27foreach (var claim in identity.FindAll(ClaimType).ToList())
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
UniqueJsonKeyClaimAction.cs (1)
39var claim = identity.FindFirst(c => string.Equals(c.Type, ClaimType, StringComparison.OrdinalIgnoreCase));
Microsoft.AspNetCore.Authentication.Test (12)
CertificateTests.cs (1)
831foreach (Claim claim in context.User.Claims)
CookieTests.cs (2)
775var claim = id.FindFirst("counter"); 831var claim = id.FindFirst("counter");
GoogleTests.cs (1)
706context.Principal.AddIdentity(new ClaimsIdentity(new Claim[] { new Claim("RefreshToken", refreshToken, ClaimValueTypes.String, "Google") }, "Google"));
JwtBearerTests.cs (2)
494var identifier = identity.FindFirst(ClaimTypes.NameIdentifier); 1195var identifier = context.User.FindFirst(ClaimTypes.NameIdentifier);
JwtBearerTests_Handler.cs (2)
471var identifier = identity.FindFirst(ClaimTypes.NameIdentifier); 1227var identifier = context.User.FindFirst(ClaimTypes.NameIdentifier);
MicrosoftAccountTests.cs (1)
228context.Principal.AddIdentity(new ClaimsIdentity(new Claim[] { new Claim("RefreshToken", refreshToken, ClaimValueTypes.String, "Microsoft") }, "Microsoft"));
OpenIdConnect\UniqueJsonKeyClaimActionTests.cs (1)
22var claim = identity.FindFirst("claimType");
TicketSerializerTests.cs (2)
89var claim = new Claim("type", "value", "valueType", "issuer", "original-issuer"); 109var readClaim = readTicket.Principal.FindFirst("type");
Microsoft.AspNetCore.Authorization (2)
ClaimsAuthorizationRequirement.cs (2)
58foreach (var claim in context.User.Claims) 69foreach (var claim in context.User.Claims)
Microsoft.AspNetCore.Authorization.Test (26)
AuthorizationMiddlewareTests.cs (2)
1014new Claim[] { 1024new Claim[] {
DefaultAuthorizationServiceTests.cs (24)
41var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("Permission", "CanViewPage") })); 62var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("Permission", "CanViewPage") }, "Basic")); 79new Claim[] { 207new Claim[] { 229new Claim[] { 250new Claim[] { 271new Claim[0], 319new Claim[] { 353new Claim[] { 375new Claim[] { 395new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "Name") }, "AuthType") 412new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Role, "Admin") }, "AuthType") 429new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Role, "Users") }, "AuthType")); 446new Claim[] { 467new Claim[] { 494new Claim[] { 520new Claim[] { 590new Claim[] { 731new Claim[] { 759new Claim[] { 786new Claim[] { 850new Claim[] { 893new Claim[] { 914new Claim[] {
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
AuthenticationStateSerializationOptions.cs (2)
52foreach (var claim in authenticationState.User.Claims) 64foreach (var roleClaim in authenticationState.User.FindAll(data.RoleClaimType))
Microsoft.AspNetCore.Http.Connections.Tests (1)
HttpConnectionDispatcherTests.cs (1)
3304var claims = new List<Claim>
Microsoft.AspNetCore.Identity (13)
SignInManager.cs (13)
165IList<Claim> claims = Array.Empty<Claim>(); 167var authenticationMethod = auth?.Principal?.FindFirst(ClaimTypes.AuthenticationMethod); 168var amr = auth?.Principal?.FindFirst("amr"); 172claims = new List<Claim>(); 207IList<Claim> additionalClaims = Array.Empty<Claim>(); 210additionalClaims = new List<Claim>(); 223public virtual Task SignInWithClaimsAsync(TUser user, bool isPersistent, IEnumerable<Claim> additionalClaims) 233public virtual async Task SignInWithClaimsAsync(TUser user, AuthenticationProperties? authenticationProperties, IEnumerable<Claim> additionalClaims) 236foreach (var claim in additionalClaims) 500var claims = new List<Claim>(); 850await SignInWithClaimsAsync(user, isPersistent, new Claim[] { new Claim("amr", "pwd") });
Microsoft.AspNetCore.Identity.EntityFrameworkCore (20)
RoleStore.cs (4)
336public virtual async Task<IList<Claim>> GetClaimsAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken)) 351public virtual Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)) 368public virtual async Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)) 393protected virtual TRoleClaim CreateRoleClaim(TRole role, Claim claim)
UserOnlyStore.cs (8)
291public override async Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken)) 306public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 311foreach (var claim in claims) 326public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 348public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 353foreach (var claim in claims) 466public override async Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
UserStore.cs (8)
406public override async Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken)) 421public override Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 426foreach (var claim in claims) 441public override async Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 463public override async Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 468foreach (var claim in claims) 581public override async Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (22)
SqlStoreOnlyUsersTestBase.cs (2)
147Claim[] userClaims = 152foreach (var c in userClaims)
SqlStoreTestBase.cs (2)
253Claim[] userClaims = 258foreach (var c in userClaims)
UserStoreWithGenericsTest.cs (18)
102Claim[] claims = { new Claim("c1", "v1", null, "i1"), new Claim("c2", "v2", null, "i2"), new Claim("c2", "v3", null, "i3") }; 103foreach (Claim c in claims) 132Claim[] claims = { new Claim("c", "v", null, "i1"), new Claim("c2", "v2", null, "i2"), new Claim("c2", "v3", null, "i3") }; 133foreach (Claim c in claims) 162Claim claim = new Claim("c", "b", "i"); 163Claim oldClaim = userClaims.FirstOrDefault(); 167Claim newClaim = newUserClaims.FirstOrDefault(); 174public class ClaimEqualityComparer : IEqualityComparer<Claim> 176public static IEqualityComparer<Claim> Default = new ClaimEqualityComparer(); 178public bool Equals(Claim x, Claim y) 183public int GetHashCode(Claim obj) 218protected override IdentityUserClaimWithIssuer CreateUserClaim(IdentityUserWithGenerics user, Claim claim) 256protected override IdentityRoleClaimWithIssuer CreateRoleClaim(MyIdentityRole role, Claim claim) 266public override Claim ToClaim() 271public override void InitializeFromClaim(Claim other) 283public override Claim ToClaim() 288public override void InitializeFromClaim(Claim other)
Microsoft.AspNetCore.Identity.InMemory.Test (13)
InMemoryStore.cs (4)
126public Task<IList<Claim>> GetClaimsAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken)) 129return Task.FromResult<IList<Claim>>(claims); 132public Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)) 138public Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken))
InMemoryUserStore.cs (9)
33public Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken)) 36return Task.FromResult<IList<Claim>>(claims); 39public Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 41foreach (var claim in claims) 48public Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 59public Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 61foreach (var claim in claims) 334public Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.AspNetCore.Identity.Specification.Tests (13)
IdentitySpecificationTestBase.cs (2)
239Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") }; 240foreach (Claim c in claims)
UserManagerSpecificationTests.cs (11)
709Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") }; 710foreach (Claim c in claims) 740Claim[] claims = { new Claim("c", "v"), new Claim("c2", "v2"), new Claim("c2", "v3") }; 741foreach (Claim c in claims) 774Claim claim = new Claim("c", "b"); 775Claim oldClaim = userClaims.Count == 0 ? null : userClaims[0]; 779Claim newClaim = newUserClaims.Count == 0 ? null : newUserClaims[0]; 802Claim claim = new Claim("c", "b"); 803Claim oldClaim = userClaims.Count == 0 ? null : userClaims[0]; 807Claim newClaim = newUserClaims.Count == 0 ? null : newUserClaims[0]; 812Claim oldClaim2 = userClaims2.Count == 0 ? null : userClaims2[0];
Microsoft.AspNetCore.Identity.Test (28)
SignInManagerTest.cs (1)
626signInManager.Setup(s => s.SignInWithClaimsAsync(user, It.IsAny<AuthenticationProperties>(), It.IsAny<IEnumerable<Claim>>())).Returns(Task.FromResult(0)).Verifiable();
UserClaimsPrincipalFactoryTest.cs (3)
102foreach (var cl in userClaims) 106foreach (var cl in adminClaims) 110foreach (var cl in localClaims)
UserManagerTest.cs (24)
506var claims = new Claim[] { new Claim("1", "1"), new Claim("2", "2"), new Claim("3", "3") }; 527var claim = new Claim("1", "1"); 528store.Setup(s => s.AddClaimsAsync(user, It.IsAny<IEnumerable<Claim>>(), CancellationToken.None)) 548var claim = new Claim("1", "1"); 549var newClaim = new Claim("1", "2"); 550store.Setup(s => s.ReplaceClaimAsync(user, It.IsAny<Claim>(), It.IsAny<Claim>(), CancellationToken.None)) 635var claims = new Claim[] { new Claim("1", "1"), new Claim("2", "2"), new Claim("3", "3") }; 656var claim = new Claim("1", "1"); 657store.Setup(s => s.RemoveClaimsAsync(user, It.IsAny<IEnumerable<Claim>>(), CancellationToken.None)) 1218public Task<IList<Claim>> GetClaimsAsync(PocoUser user, CancellationToken cancellationToken = default(CancellationToken)) 1220return Task.FromResult<IList<Claim>>(new List<Claim>()); 1223public Task AddClaimsAsync(PocoUser user, IEnumerable<Claim> claim, CancellationToken cancellationToken = default(CancellationToken)) 1228public Task ReplaceClaimAsync(PocoUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 1233public Task RemoveClaimsAsync(PocoUser user, IEnumerable<Claim> claim, CancellationToken cancellationToken = default(CancellationToken)) 1447public Task<IList<PocoUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken)) 1498public Task<IList<Claim>> GetClaimsAsync(PocoUser user, CancellationToken cancellationToken = default(CancellationToken)) 1503public Task AddClaimsAsync(PocoUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 1508public Task ReplaceClaimAsync(PocoUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)) 1513public Task RemoveClaimsAsync(PocoUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)) 1703public Task<IList<PocoUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.AspNetCore.Mvc.Core.Test (2)
Authorization\AuthorizeFilterTest.cs (2)
577new Claim[] { 587new Claim[] {
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
src\SignalR\common\testassets\Tests.Utils\TestClient.cs (1)
53var claims = new List<Claim> { new Claim(ClaimTypes.Name, claimValue) };
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
TestClient.cs (1)
53var claims = new List<Claim> { new Claim(ClaimTypes.Name, claimValue) };
Microsoft.Extensions.Identity.Core (39)
IRoleClaimStore.cs (7)
18/// Gets a list of <see cref="Claim"/>s to be belonging to the specified <paramref name="role"/> as an asynchronous operation. 23/// A <see cref="Task{TResult}"/> that represents the result of the asynchronous query, a list of <see cref="Claim"/>s. 25Task<IList<Claim>> GetClaimsAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken)); 31/// <param name="claim">The <see cref="Claim"/> to add.</param> 34Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)); 40/// <param name="claim">The <see cref="Claim"/> to remove.</param> 43Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken));
IUserClaimStore.cs (11)
18/// Gets a list of <see cref="Claim"/>s to be belonging to the specified <paramref name="user"/> as an asynchronous operation. 23/// A <see cref="Task{TResult}"/> that represents the result of the asynchronous query, a list of <see cref="Claim"/>s. 25Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken); 31/// <param name="claims">The collection of <see cref="Claim"/>s to add.</param> 34Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken); 44Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken); 50/// <param name="claims">A collection of <see cref="Claim"/>s to remove.</param> 53Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken); 56/// Returns a list of users who contain the specified <see cref="Claim"/>. 64Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken);
PrincipalExtensions.cs (1)
22var claim = principal.FindFirst(claimType);
RoleManager.cs (6)
134/// Gets a flag indicating whether the underlying persistence store supports <see cref="Claim"/>s for roles. 137/// true if the underlying persistence store supports <see cref="Claim"/>s for roles, otherwise false. 323public virtual async Task<IdentityResult> AddClaimAsync(TRole role, Claim claim) 343public virtual async Task<IdentityResult> RemoveClaimAsync(TRole role, Claim claim) 358/// The <see cref="Task"/> that represents the asynchronous operation, containing the list of <see cref="Claim"/>s 361public virtual Task<IList<Claim>> GetClaimsAsync(TRole role)
UserManager.cs (14)
987public virtual Task<IdentityResult> AddClaimAsync(TUser user, Claim claim) 993return AddClaimsAsync(user, new Claim[] { claim }); 1005public virtual async Task<IdentityResult> AddClaimsAsync(TUser user, IEnumerable<Claim> claims) 1026public virtual async Task<IdentityResult> ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim) 1042/// <param name="claim">The <see cref="Claim"/> to remove.</param> 1047public virtual Task<IdentityResult> RemoveClaimAsync(TUser user, Claim claim) 1053return RemoveClaimsAsync(user, new Claim[] { claim }); 1060/// <param name="claims">A collection of <see cref="Claim"/>s to remove.</param> 1065public virtual async Task<IdentityResult> RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims) 1077/// Gets a list of <see cref="Claim"/>s to be belonging to the specified <paramref name="user"/> as an asynchronous operation. 1081/// A <see cref="Task{TResult}"/> that represents the result of the asynchronous query, a list of <see cref="Claim"/>s. 1083public virtual async Task<IList<Claim>> GetClaimsAsync(TUser user) 1875public virtual Task<IList<TUser>> GetUsersForClaimAsync(Claim claim)
Microsoft.Extensions.Identity.Stores (16)
IdentityRoleClaim.cs (3)
38/// <returns>The <see cref="Claim"/> that was produced.</returns> 39public virtual Claim ToClaim() 48public virtual void InitializeFromClaim(Claim? other)
IdentityUserClaim.cs (2)
39public virtual Claim ToClaim() 48public virtual void InitializeFromClaim(Claim claim)
RoleStoreBase.cs (4)
212public abstract Task<IList<Claim>> GetClaimsAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken)); 221public abstract Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)); 230public abstract Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken)); 246protected virtual TRoleClaim CreateRoleClaim(TRole role, Claim claim)
UserStoreBase.cs (7)
67protected virtual TUserClaim CreateUserClaim(TUser user, Claim claim) 358public abstract Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken)); 367public abstract Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)); 377public abstract Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken)); 386public abstract Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken)); 793public abstract Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken));
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
851[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Claims.Claim))]
netstandard (1)
netstandard.cs (1)
1835[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Claims.Claim))]
OpenIdConnectSample (1)
Startup.cs (1)
368foreach (var claim in oldClaims)
PathSchemeSelection (1)
Controllers\AccountController.cs (1)
36var claims = new List<Claim>
SecurityWebSite (1)
BearerAuth.cs (1)
34public static string GetTokenText(IEnumerable<Claim> claims)
SocialSample (1)
Startup.cs (1)
451foreach (var claim in context.User.Claims)
StaticFilesAuth (1)
Controllers\AccountController.cs (1)
35var claims = new List<Claim>
System.Security.Claims (146)
System\Security\Claims\Claim.cs (44)
42/// Initializes an instance of <see cref="Claim"/> using a <see cref="BinaryReader"/>. 45/// <param name="reader">a <see cref="BinaryReader"/> pointing to a <see cref="Claim"/>.</param> 53/// Initializes an instance of <see cref="Claim"/> using a <see cref="BinaryReader"/>. 56/// <param name="reader">a <see cref="BinaryReader"/> pointing to a <see cref="Claim"/>.</param> 57/// <param name="subject"> the value for <see cref="Claim.Subject"/>, which is the <see cref="ClaimsIdentity"/> that has these claims.</param> 142/// Creates a <see cref="Claim"/> with the specified type and value. 148/// <see cref="Claim.Issuer"/> is set to <see cref="ClaimsIdentity.DefaultIssuer"/>, 149/// <see cref="Claim.ValueType"/> is set to <see cref="ClaimValueTypes.String"/>, 150/// <see cref="Claim.OriginalIssuer"/> is set to <see cref="ClaimsIdentity.DefaultIssuer"/>, and 151/// <see cref="Claim.Subject"/> is set to null. 162/// Creates a <see cref="Claim"/> with the specified type, value, and value type. 169/// <see cref="Claim.Issuer"/> is set to <see cref="ClaimsIdentity.DefaultIssuer"/>, 170/// <see cref="Claim.OriginalIssuer"/> is set to <see cref="ClaimsIdentity.DefaultIssuer"/>, 171/// and <see cref="Claim.Subject"/> is set to null. 182/// Creates a <see cref="Claim"/> with the specified type, value, value type, and issuer. 190/// <see cref="Claim.OriginalIssuer"/> is set to value of the <paramref name="issuer"/> parameter, 191/// <see cref="Claim.Subject"/> is set to null. 202/// Creates a <see cref="Claim"/> with the specified type, value, value type, issuer and original issuer. 211/// <see cref="Claim.Subject"/> is set to null. 222/// Creates a <see cref="Claim"/> with the specified type, value, value type, issuer, original issuer and subject. 271/// Copy constructor for <see cref="Claim"/> 273/// <param name="other">the <see cref="Claim"/> to copy.</param> 274/// <remarks><see cref="Claim.Subject"/>will be set to 'null'.</remarks> 276protected Claim(Claim other) 282/// Copy constructor for <see cref="Claim"/> 284/// <param name="other">the <see cref="Claim"/> to copy.</param> 285/// <param name="subject">the <see cref="ClaimsIdentity"/> to assign to <see cref="Claim.Subject"/>.</param> 286/// <remarks><see cref="Claim.Subject"/>will be set to 'subject'.</remarks> 288protected Claim(Claim other, ClaimsIdentity? subject) 321/// Gets the issuer of the <see cref="Claim"/>. 329/// Gets the original issuer of the <see cref="Claim"/>. 342/// Gets the collection of Properties associated with the <see cref="Claim"/>. 347/// Gets the subject of the <see cref="Claim"/>. 355/// Gets the claim type of the <see cref="Claim"/>. 364/// Gets the value of the <see cref="Claim"/>. 372/// Gets the value type of the <see cref="Claim"/>. 381/// Creates a new instance <see cref="Claim"/> with values copied from this object. 383public virtual Claim Clone() 389/// Creates a new instance <see cref="Claim"/> with values copied from this object. 391/// <param name="identity">the value for <see cref="Claim.Subject"/>, which is the <see cref="ClaimsIdentity"/> that has these claims.</param> 392/// <remarks><see cref="Claim.Subject"/> will be set to 'identity'.</remarks> 393public virtual Claim Clone(ClaimsIdentity? identity) 511/// Returns a string representation of the <see cref="Claim"/> object. 516/// <returns>The string representation of the <see cref="Claim"/> object.</returns>
System\Security\Claims\ClaimsIdentity.cs (75)
36private List<List<Claim>>? _externalClaims; 38private readonly List<Claim> _instanceClaims = new List<Claim>(); 55: this((IIdentity?)null, (IEnumerable<Claim>?)null, (string?)null, (string?)null, (string?)null) 63/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 65: this(identity, (IEnumerable<Claim>?)null, (string?)null, (string?)null, (string?)null) 74/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 76public ClaimsIdentity(IEnumerable<Claim>? claims) 86: this((IIdentity?)null, (IEnumerable<Claim>?)null, authenticationType, (string?)null, (string?)null) 95/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 96public ClaimsIdentity(IEnumerable<Claim>? claims, string? authenticationType) 106/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 107public ClaimsIdentity(IIdentity? identity, IEnumerable<Claim>? claims) 116/// <param name="nameType">The <see cref="Claim.Type"/> used when obtaining the value of <see cref="ClaimsIdentity.Name"/>.</param> 117/// <param name="roleType">The <see cref="Claim.Type"/> used when performing logic for <see cref="ClaimsPrincipal.IsInRole"/>.</param> 118/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 120: this((IIdentity?)null, (IEnumerable<Claim>?)null, authenticationType, nameType, roleType) 129/// <param name="nameType">The <see cref="Claim.Type"/> used when obtaining the value of <see cref="ClaimsIdentity.Name"/>.</param> 130/// <param name="roleType">The <see cref="Claim.Type"/> used when performing logic for <see cref="ClaimsPrincipal.IsInRole"/>.</param> 131/// <remarks><seealso cref="ClaimsIdentity(IIdentity, IEnumerable{Claim}, string, string, string)"/> for details on how internal values are set.</remarks> 132public ClaimsIdentity(IEnumerable<Claim>? claims, string? authenticationType, string? nameType, string? roleType) 143/// <param name="nameType">The <see cref="Claim.Type"/> used when obtaining the value of <see cref="ClaimsIdentity.Name"/>.</param> 144/// <param name="roleType">The <see cref="Claim.Type"/> used when performing logic for <see cref="ClaimsPrincipal.IsInRole"/>.</param> 147/// <para>All <see cref="Claim"/>s are copied into this instance in a <see cref="List{Claim}"/>. Each Claim is examined and if Claim.Subject != this, then Claim.Clone(this) is called before the claim is added.</para> 151public ClaimsIdentity(IIdentity? identity, IEnumerable<Claim>? claims, string? authenticationType, string? nameType, string? roleType) 306public virtual IEnumerable<Claim> Claims 319private IEnumerable<Claim> CombinedClaimsIterator() 330foreach (Claim claim in _externalClaims[j]) 353internal List<List<Claim>> ExternalClaims => _externalClaims ??= new List<List<Claim>>(); 367/// <remarks>Calls <see cref="FindFirst(string)"/> where string == NameClaimType, if found, returns <see cref="Claim.Value"/> otherwise null.</remarks> 373Claim? claim = FindFirst(_nameClaimType); 408/// Adds a single <see cref="Claim"/> to an internal list. 410/// <param name="claim">the <see cref="Claim"/>add.</param> 411/// <remarks>If <see cref="Claim.Subject"/> != this, then Claim.Clone(this) is called before the claim is added.</remarks> 413public virtual void AddClaim(Claim claim) 431/// <remarks>Each claim is examined and if <see cref="Claim.Subject"/> != this, then Claim.Clone(this) is called before the claim is added.</remarks> 433public virtual void AddClaims(IEnumerable<Claim?> claims) 437foreach (Claim? claim in claims) 456/// Attempts to remove a <see cref="Claim"/> the internal list. 458/// <param name="claim">the <see cref="Claim"/> to match.</param> 459/// <remarks> It is possible that a <see cref="Claim"/> returned from <see cref="Claims"/> cannot be removed. This would be the case for 'External' claims that are provided by reference. 462public virtual bool TryRemoveClaim(Claim? claim) 484/// Removes a <see cref="Claim"/> from the internal list. 486/// <param name="claim">the <see cref="Claim"/> to match.</param> 487/// <remarks> It is possible that a <see cref="Claim"/> returned from <see cref="Claims"/> cannot be removed. This would be the case for 'External' claims that are provided by reference. 491public virtual void RemoveClaim(Claim? claim) 504private void SafeAddClaims(IEnumerable<Claim?> claims) 506foreach (Claim? claim in claims) 526private void SafeAddClaim(Claim? claim) 547public virtual IEnumerable<Claim> FindAll(Predicate<Claim> match) 552IEnumerable<Claim> Core(Predicate<Claim> match) 554foreach (Claim claim in Claims) 571public virtual IEnumerable<Claim> FindAll(string type) 576IEnumerable<Claim> Core(string type) 578foreach (Claim claim in Claims) 592/// Retrieves the first <see cref="Claim"/> that is matched by <paramref name="match"/>. 595/// <returns>A <see cref="Claim"/>, null if nothing matches.</returns> 597public virtual Claim? FindFirst(Predicate<Claim> match) 601foreach (Claim claim in Claims) 613/// Retrieves the first <see cref="Claim"/> where Claim.Type equals <paramref name="type"/>. 616/// <returns>A <see cref="Claim"/>, null if nothing matches.</returns> 619public virtual Claim? FindFirst(string type) 623foreach (Claim claim in Claims) 643public virtual bool HasClaim(Predicate<Claim> match) 647foreach (Claim claim in Claims) 672foreach (Claim claim in Claims) 767/// Provides an extensibility point for derived types to create a custom <see cref="Claim"/>. 770/// <returns>a new <see cref="Claim"/>.</returns> 771protected virtual Claim CreateClaim(BinaryReader reader) 881foreach (var claim in _instanceClaims) 943foreach (Claim item in Claims)
System\Security\Claims\ClaimsPrincipal.cs (24)
228public virtual IEnumerable<Claim> Claims 234foreach (Claim claim in identity.Claims) 293public virtual IEnumerable<Claim> FindAll(Predicate<Claim> match) 298IEnumerable<Claim> Core(Predicate<Claim> match) 304foreach (Claim claim in identity.FindAll(match)) 318/// <remarks>Each <see cref="ClaimsIdentity"/> is called. <seealso cref="ClaimsIdentity.FindAll(Predicate{Claim})"/>.</remarks> 320public virtual IEnumerable<Claim> FindAll(string type) 325IEnumerable<Claim> Core(string type) 331foreach (Claim claim in identity.FindAll(type)) 341/// Retrieves the first <see cref="Claim"/> that is matched by <paramref name="match"/>. 344/// <returns>A <see cref="Claim"/>, null if nothing matches.</returns> 347public virtual Claim? FindFirst(Predicate<Claim> match) 351Claim? claim = null; 369/// Retrieves the first <see cref="Claim"/> where the Claim.Type equals <paramref name="type"/>. 372/// <returns>A <see cref="Claim"/>, null if nothing matches.</returns> 373/// <remarks>Each <see cref="ClaimsIdentity"/> is called. <seealso cref="ClaimsIdentity.FindFirst(Predicate{Claim})"/>.</remarks> 375public virtual Claim? FindFirst(string type) 379Claim? claim = null; 403public virtual bool HasClaim(Predicate<Claim> match) 427/// <remarks>Each <see cref="ClaimsIdentity"/> is called. <seealso cref="ClaimsIdentity.HasClaim(Predicate{Claim})"/>.</remarks> 589foreach (Claim item in Claims)
System\Security\Claims\GenericIdentity.cs (1)
50public override IEnumerable<Claim> Claims
System\Security\Claims\GenericPrincipal.cs (2)
49List<Claim> roleClaims = new List<Claim>(roles.Length);
System.Security.Principal.Windows (5)
artifacts\obj\System.Security.Principal.Windows\Debug\net9.0\System.Security.Principal.Windows.notsupported.cs (5)
248public override System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } 249public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> DeviceClaims { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } 260public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> UserClaims { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } 278public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> DeviceClaims { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } } 280public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> UserClaims { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_Principal); } }