public void CanMapIdentityResources() { var model = new Duende.IdentityServer.Models.IdentityResource(); var mappedEntity = model.ToEntity(); var mappedModel = mappedEntity.ToModel(); Assert.NotNull(mappedModel); Assert.NotNull(mappedEntity); }
public async Task CreateAsync(IdentityScopeModel model) { var scope = new Duende.IdentityServer.Models.IdentityResource() { Name = model.Name, DisplayName = model.DisplayName?.Trim() }; var claims = model.UserClaims?.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToArray() ?? Enumerable.Empty <string>(); if (claims.Any()) { scope.UserClaims = claims.ToList(); } _context.IdentityResources.Add(scope.ToEntity()); await _context.SaveChangesAsync(); }