예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,PostLogoutRedirectUri")] ClientPostLogoutRedirectUris clientPostLogoutRedirectUris)
        {
            if (id != clientPostLogoutRedirectUris.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientPostLogoutRedirectUris);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientPostLogoutRedirectUrisExists(clientPostLogoutRedirectUris.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientPostLogoutRedirectUris));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,ClientId,PostLogoutRedirectUri")] ClientPostLogoutRedirectUris clientPostLogoutRedirectUris)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientPostLogoutRedirectUris);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientPostLogoutRedirectUris));
        }
        public async Task <int> Insert(ClientPostLogoutRedirectUris clientPostLogoutRedirectUris)
        {
            var isExists = await CheckExists(clientPostLogoutRedirectUris.ClientId, clientPostLogoutRedirectUris.Uri);

            if (isExists)
            {
                return(-1);
            }

            _clientPostLogoutRedirectUrisRepository.Create(clientPostLogoutRedirectUris);
            return(await Context.SaveChangesAsync());
        }
        public async Task <int> Update(ClientPostLogoutRedirectUris clientPostLogoutRedirectUris)
        {
            var isExists = await CheckExists(clientPostLogoutRedirectUris.ClientId, clientPostLogoutRedirectUris.Uri);

            if (isExists)
            {
                return(-1);
            }

            var info = await GetInfo(clientPostLogoutRedirectUris.Id);

            if (info == null)
            {
                return(-2);
            }

            info.Uri = clientPostLogoutRedirectUris.Uri;
            return(await Context.SaveChangesAsync());
        }
예제 #5
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 MapClientPostLogoutRedirectUris(this ClientPostLogoutRedirectUris client)
 {
     return(client.PostLogoutRedirectUri);
 }