public async Task <ActionResult> Index(PagerParameters pagerParameters) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageScopes)) { return(Forbid()); } var siteSettings = await _siteService.GetSiteSettingsAsync(); var pager = new Pager(pagerParameters, siteSettings.PageSize); var count = await _scopeManager.CountAsync(); var model = new OpenIdScopeIndexViewModel { Pager = (await New.Pager(pager)).TotalItemCount(count) }; foreach (var scope in await _scopeManager.ListAsync(pager.PageSize, pager.GetStartIndex())) { model.Scopes.Add(new OpenIdScopeEntry { Description = await _scopeManager.GetDescriptionAsync(scope), DisplayName = await _scopeManager.GetDisplayNameAsync(scope), Id = await _scopeManager.GetPhysicalIdAsync(scope), Name = await _scopeManager.GetNameAsync(scope) }); } return(View(model)); }
public async Task <IActionResult> Create(string returnUrl = null) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageApplications)) { return(Forbid()); } var model = new CreateOpenIdApplicationViewModel(); var roleService = HttpContext.RequestServices?.GetService <IRoleService>(); if (roleService != null) { foreach (var role in await roleService.GetRoleNamesAsync()) { model.RoleEntries.Add(new CreateOpenIdApplicationViewModel.RoleEntry { Name = role }); } } else { await _notifier.WarningAsync(H["There are no registered services to provide roles."]); } await foreach (var scope in _scopeManager.ListAsync(null, null, default)) { model.ScopeEntries.Add(new CreateOpenIdApplicationViewModel.ScopeEntry { Name = await _scopeManager.GetNameAsync(scope) }); } ViewData[nameof(OpenIdServerSettings)] = await GetServerSettingsAsync(); ViewData["ReturnUrl"] = returnUrl; return(View(model)); }