247 references to 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")
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 (1)
Startup.cs (1)
36claims.Add(new Claim(ClaimTypes.Name, "bob"));
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.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.Test (51)
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 (1)
122id.AddClaim(new Claim("Count", Options.Instance.Count.ToString(CultureInfo.InvariantCulture)));
GoogleTests.cs (1)
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")
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"));
WsFederation\WsFederationTest.cs (2)
335identity.AddClaim(new Claim("ReturnEndpoint", "true")); 336identity.AddClaim(new Claim("Authenticated", "true"));
WsFederation\WsFederationTest_Handler.cs (2)
331identity.AddClaim(new Claim("ReturnEndpoint", "true")); 332identity.AddClaim(new Claim("Authenticated", "true"));
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 (4)
SqlStoreOnlyUsersTestBase.cs (2)
149new Claim("Whatever", "Value"), 150new Claim("Whatever2", "Value2")
SqlStoreTestBase.cs (2)
255new Claim("Whatever", "Value"), 256new Claim("Whatever2", "Value2")
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 (34)
PrincipalExtensionsTest.cs (1)
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!);
PathSchemeSelection (2)
Controllers\AccountController.cs (2)
38new Claim("user", userName), 39new Claim("role", "Member")
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")