public static IEnumerable <ScopeModel> GetApiScopeModelsFromRequest(ResourceValidationResult validatedResources, string[] scopesConsented, bool check) { var apiScopes = new List <ScopeModel>(); foreach (var parsedScope in validatedResources.ParsedScopes) { var apiScope = validatedResources.Resources.FindApiScope(parsedScope.ParsedName); if (apiScope != null) { var scopeVm = ScopeModel.CreateScopeViewModel(parsedScope, apiScope, scopesConsented.Contains(parsedScope.RawValue) || check); apiScopes.Add(scopeVm); } } if (ConsentOptions.EnableOfflineAccess && validatedResources.Resources.OfflineAccess) { apiScopes.Add(ScopeModel.GetOfflineAccessScope( scopesConsented.Contains(IdentityServerConstants.StandardScopes.OfflineAccess) || check)); } return(apiScopes); }
public static IEnumerable <ScopeModel> GetIdentityResourcesFromRequest(ResourceValidationResult validatedResources, string[] scopesConsented, bool check) { return(validatedResources.Resources.IdentityResources.Select(x => ScopeModel.CreateScopeViewModel(x, scopesConsented.Contains(x.Name) || check)).ToArray()); }