public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,Provider")] ClientIdPRestrictions clientIdPRestrictions)
        {
            if (id != clientIdPRestrictions.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientIdPRestrictions);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientIdPRestrictionsExists(clientIdPRestrictions.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientIdPRestrictions));
        }
        public async Task <IActionResult> Create([Bind("Id,ClientId,Provider")] ClientIdPRestrictions clientIdPRestrictions)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientIdPRestrictions);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientIdPRestrictions));
        }
Exemplo n.º 3
0
        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 MapClientIdPRestrictions(this ClientIdPRestrictions client)
 {
     return(client.Provider);
 }