public async Task <global::IdentityServer4.Models.Resources> MakeResourcesAsync() { var apiResources = await DeserializeApiResourcesAsync(ApiResources); var identityResources = await DeserializeIdentityResourcesAsync(IdentityResources); var result = new global::IdentityServer4.Models.Resources() { ApiResources = apiResources.ToApiResources(), IdentityResources = identityResources.ToIdentityResources(), OfflineAccess = OfflineAccess }; return(await Task.FromResult(result)); }
public virtual async Task <global::IdentityServer4.Models.Resources> GetAllResourcesAsync() { var idientities = await _asyncQueryableExecuter.ToListAsync(_identityResourceRepository.GetAll().Include(x => x.UserClaims)); var apis = await _asyncQueryableExecuter.ToListAsync(_apiResourceRepository.GetAll() .Include(x => x.Secrets) .Include(x => x.Scopes) .ThenInclude(s => s.UserClaims) .Include(x => x.UserClaims)); var result = new global::IdentityServer4.Models.Resources(ObjectMapper.Map <IEnumerable <IdentityResource> >(idientities), ObjectMapper.Map <IEnumerable <ApiResource> >(apis)); Logger.DebugFormat("Found {0} as all scopes in database", result.IdentityResources.Select(x => x.Name).Union(result.ApiResources.SelectMany(x => x.Scopes).Select(x => x.Name))); return(result); }
public virtual async Task <global::IdentityServer4.Models.Resources> GetAllResourcesAsync() { var idientities = await _asyncQueryableExecuter.ToListAsync(_identityResourceRepository.GetAll() .Include(x => x.UserClaims)); var apis = await _asyncQueryableExecuter.ToListAsync(_apiResourceRepository.GetAll() .Include(x => x.Secrets) .Include(x => x.Scopes) .ThenInclude(s => s.UserClaims) .Include(x => x.UserClaims)); var scopes = await _apiScopeRepository.GetAll().Include(c => c.UserClaims).ToListAsync(); var result = new global::IdentityServer4.Models.Resources( ObjectMapper.Map <IEnumerable <IdentityResource> >(idientities), ObjectMapper.Map <IEnumerable <ApiResource> >(apis), ObjectMapper.Map <IEnumerable <ApiScope> >(scopes)); return(result); }
public ResourcesModel(global::IdentityServer4.Models.Resources resources) : base(resources) { }
public static ResourcesModel ToResourcesModel(this global::IdentityServer4.Models.Resources model) { return(new ResourcesModel(model)); }
private ConsentViewModel GetConsentViewModel(ConsentInputModel model, string returnUrl, Client client, global::IdentityServer4.Models.Resources resources) { var vm = new ConsentViewModel { RememberConsent = model?.RememberConsent ?? true, ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty <string>(), ReturnUrl = returnUrl, ClientName = client.ClientName, ClientUrl = client.ClientUri, ClientLogoUrl = client.LogoUri, AllowRememberConsent = client.AllowRememberConsent }; vm.IdentityScopes = resources.IdentityResources.Select(x => CreateScopeViewModel(x, vm.ScopesConsented.Contains(x.Name) || model == null)).ToArray(); vm.ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => CreateScopeViewModel(x, vm.ScopesConsented.Contains(x.Name) || model == null)).ToArray(); if (ConsentOptions.EnableOfflineAccess && resources.OfflineAccess) { vm.ResourceScopes = vm.ResourceScopes.Union(new[] { GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServerConstants.StandardScopes.OfflineAccess) || model == null) }); } return(vm); }
public AbstractResourcesModel(global::IdentityServer4.Models.Resources resources) { ApiResources = Serialize(resources.ApiResources); IdentityResources = Serialize(resources.IdentityResources); OfflineAccess = resources.OfflineAccess; }