public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,Scope")] ClientScopes clientScopes) { if (id != clientScopes.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(clientScopes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientScopesExists(clientScopes.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(clientScopes)); }
private List <ClientScopes> BuildClientScopes(DataSet data) { List <ClientScopes> scopes = new List <ClientScopes>(); var table = data.Tables[0]; try { foreach (DataRow row in table.Rows) { ClientScopes scope = new ClientScopes(); scope.Code = row["Code"].ToString(); scope.IsActive = bool.Parse(row["Active"].ToString()); scope.Scope = row["ScopeName"].ToString(); scope.SecScopeId = int.Parse(row["ScopeId"].ToString()); scopes.Add(scope); } } catch (SqlException ex) { _logger.Error("BuildClientScopes: " + "ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex); throw new DatabaseException(string.Format(DatabaseMessage.DatabaseException, ErrorTagProvider.ErrorTagDatabase)); } catch (Exception ex) { _logger.Error("BuildClientScopes: " + "ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex); throw new DatabaseException(string.Format(DatabaseMessage.DatabaseException, ErrorTagProvider.ErrorTagDatabase)); } return(scopes); }
public async Task <IActionResult> Create([Bind("Id,ClientId,Scope")] ClientScopes clientScopes) { if (ModelState.IsValid) { _context.Add(clientScopes); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(clientScopes)); }
private async Task RemoveClientRelationsAsync(int clientId) { //Remove old claims var clientClaims = await ClientClaims.Where(x => x.Client.Id == clientId).ToListAsync(); ClientClaims.RemoveRange(clientClaims); //Remove old allowed scopes var clientScopes = await ClientScopes.Where(x => x.Client.Id == clientId).ToListAsync(); ClientScopes.RemoveRange(clientScopes); //Remove old grant types var clientGrantTypes = await ClientGrantTypes.Where(x => x.Client.Id == clientId).ToListAsync(); ClientGrantTypes.RemoveRange(clientGrantTypes); //Remove old redirect uri var clientRedirectUris = await ClientRedirectUris.Where(x => x.Client.Id == clientId).ToListAsync(); ClientRedirectUris.RemoveRange(clientRedirectUris); //Remove old client cors var clientCorsOrigins = await ClientCorsOrigins.Where(x => x.Client.Id == clientId).ToListAsync(); ClientCorsOrigins.RemoveRange(clientCorsOrigins); //Remove old client id restrictions var clientIdPRestrictions = await ClientIdPRestrictions.Where(x => x.Client.Id == clientId).ToListAsync(); ClientIdPRestrictions.RemoveRange(clientIdPRestrictions); //Remove old client post logout redirect var clientPostLogoutRedirectUris = await ClientPostLogoutRedirectUris.Where(x => x.Client.Id == clientId).ToListAsync(); ClientPostLogoutRedirectUris.RemoveRange(clientPostLogoutRedirectUris); }
public static string MapClientScopes(this ClientScopes client) { return(client.Scope); }