public void GivenIds3IdentityScopeWithUserClaims_ExpectClaimsCorrectlyMapped() { var scopeClaim = new ScopeClaim { Name = Guid.NewGuid().ToString(), Description = Guid.NewGuid().ToString(), // data will be lost AlwaysIncludeInIdToken = true // data will be lost }; var scope = new Scope { Type = (int)ScopeType.Identity, ScopeClaims = new List <ScopeClaim>() { scopeClaim } }; var scopes = new List <Scope> { scope }; var resources = scopes.GetIdentityResources(); resources.Should().NotBeEmpty(); resources.Should().HaveCount(scopes.Count); var resource = resources.Single(x => x.Name == scope.Name); resource.Should().NotBeNull(); resource.UserClaims.Should().NotBeEmpty(); resource.UserClaims.Should().Contain(scopeClaim.Name); }
public async Task <ScopeClaim> AddScopeClaim(ScopeClaim scopeClaim, string scopeName) { var scope = await _context.Scopes.SingleAsync(s => s.Name == scopeName); scopeClaim.Scope = scope; await _context.SaveChangesAsync(); return(scopeClaim); }