Esempio n. 1
0
 /// <summary>
 /// Gets API resources by API resource name.
 /// </summary>
 public virtual async Task <IEnumerable <IdentityServer4.Models.ApiResource> > FindApiResourcesByNameAsync(IEnumerable <string> apiResourceNames)
 {
     return(await GetCacheItemsAsync(
                ApiResourceCache,
                apiResourceNames,
                async keys => await ApiResourceRepository.FindByNameAsync(keys, includeDetails: true),
                (models, cacheKeyPrefix) => new List <IEnumerable <KeyValuePair <string, IdentityServer4.Models.ApiResource> > >
     {
         models.Select(x => new KeyValuePair <string, IdentityServer4.Models.ApiResource>(AddCachePrefix(x.Name, cacheKeyPrefix), x))
     }, ApiResourceNameCacheKeyPrefix));
 }
Esempio n. 2
0
        public virtual async Task <ApiResource> FindApiResourceAsync(string name)
        {
            var resource = await ApiResourceRepository.FindByNameAsync(name);

            return(ObjectMapper.Map <ApiResources.ApiResource, ApiResource>(resource));
        }