public virtual async Task <Resources> GetAllResourcesAsync() { var identityResources = await IdentityResourceRepository.GetListAsync(includeDetails : true); var apiResources = await ApiResourceRepository.GetListAsync(includeDetails : true); return(new Resources( ObjectMapper.Map <List <IdentityResource>, IdentityServer4.Models.IdentityResource[]>(identityResources), ObjectMapper.Map <List <ApiResources.ApiResource>, ApiResource[]>(apiResources) )); }
/// <summary> /// Gets identity resources by scope name. /// </summary> public virtual async Task <IEnumerable <IdentityServer4.Models.IdentityResource> > FindIdentityResourcesByScopeNameAsync(IEnumerable <string> scopeNames) { return(await GetCacheItemsAsync( IdentityResourceCache, scopeNames, async keys => await IdentityResourceRepository.GetListByScopeNameAsync(keys, includeDetails: true), (models, cacheKeyPrefix) => new List <IEnumerable <KeyValuePair <string, IdentityServer4.Models.IdentityResource> > > { models.Select(x => new KeyValuePair <string, IdentityServer4.Models.IdentityResource>(AddCachePrefix(x.Name, cacheKeyPrefix), x)) })); }
/// <summary> /// Gets all resources. /// </summary> public virtual async Task <IdentityServer4.Models.Resources> GetAllResourcesAsync() { return(await ResourcesCache.GetOrAddAsync(AllResourcesKey, async() => { var identityResources = await IdentityResourceRepository.GetListAsync(includeDetails: true); var apiResources = await ApiResourceRepository.GetListAsync(includeDetails: true); var apiScopes = await ApiScopeRepository.GetListAsync(includeDetails: true); return new Resources( ObjectMapper.Map <List <Volo.Abp.IdentityServer.IdentityResources.IdentityResource>, List <IdentityServer4.Models.IdentityResource> >(identityResources), ObjectMapper.Map <List <Volo.Abp.IdentityServer.ApiResources.ApiResource>, List <IdentityServer4.Models.ApiResource> >(apiResources), ObjectMapper.Map <List <Volo.Abp.IdentityServer.ApiScopes.ApiScope>, List <IdentityServer4.Models.ApiScope> >(apiScopes)); }, () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = Options.Caching.ClientStoreExpiration })); }
public virtual async Task <IEnumerable <IdentityServer4.Models.IdentityResource> > FindIdentityResourcesByScopeAsync(IEnumerable <string> scopeNames) { var resource = await IdentityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails : true); return(ObjectMapper.Map <List <IdentityResource>, List <IdentityServer4.Models.IdentityResource> >(resource)); }