Exemple #1
0
        public async Task <IEnumerable <IdentityServer4.Models.ApiScope> > FindApiScopesByNameAsync(IEnumerable <string> scopeNames)
        {
            var apiScopes = await _apiScopeRepository.GetApiScopesByNameAsync(scopeNames.ToArray());

            var result = apiScopes.Select(x => new IdentityServer4.Models.ApiScope
            {
                Enabled                 = x.Enabled,
                Name                    = x.Name,
                DisplayName             = x.DisplayName,
                Description             = x.Description,
                Required                = x.Required,
                Emphasize               = x.Emphasize,
                ShowInDiscoveryDocument = x.ShowInDiscoveryDocument,
                UserClaims              = x.UserClaims.Select(c => c.Type).ToList(),
                Properties              = x.Properties.ToDictionary(k => k.Key, v => v.Value)
            }).ToArray();

            return(result);
        }