public async Task <bool> AddRedirectUriToClient(int clientId, ClientRedirectUrlDto redirectUriDto) { await this._configContext.AddAsync(new IdentityServer4.EntityFramework.Entities.ClientRedirectUri { ClientId = redirectUriDto.ClientId, RedirectUri = redirectUriDto.RedirectUri }); return(true); }
public async Task <ActionResult <int> > UpdateClientRedirectUriAsync([FromBody] ClientRedirectUrlDto redirectUri) { var currentClient = await this._configurationManagementService.ReturnClientAsync(redirectUri.ClientId); if (currentClient == null) { return(NotFound()); } await this._configurationManagementService.UpdateClientRedirectUriAsync(redirectUri); await this._configurationManagementService.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult> AddRedirectUriToClient(int clientId, [FromBody] ClientRedirectUrlDto redirectUriDto) { if (clientId == 0 || redirectUriDto == null) { return(BadRequest()); } var currentClient = await this._configurationManagementService.ReturnClientAsync(clientId); if (currentClient == null) { return(NotFound()); } var result = await this._configurationManagementService.AddRedirectUriToClient(clientId, redirectUriDto); await this._configurationManagementService.SaveChangesAsync(); return(Ok(result)); }
public async Task RemoveRedirectUrisFromClaimsAsync(ClientRedirectUrlDto redirectUrlDtos) { var client = await this._configContext .Clients.Include(c => c.RedirectUris) .FirstOrDefaultAsync(i => i.Id == redirectUrlDtos.ClientId); if (client == null) { throw new Exception("Entity Not Found"); } var foundRedirectUril = client.RedirectUris.FirstOrDefault(c => c.Id == redirectUrlDtos.Id); if (foundRedirectUril == null) { throw new Exception("RedirectUri not found"); } this._configContext.Remove(foundRedirectUril); }
public async Task <int> UpdateClientRedirectUriAsync(ClientRedirectUrlDto redirectUri) { var client = await this._configContext .Clients.Include(c => c.RedirectUris) .FirstOrDefaultAsync(i => i.Id == redirectUri.ClientId); if (client == null) { throw new Exception("Entity Not Found"); } var foundRedirectUri = client.RedirectUris.FirstOrDefault(c => c.Id == redirectUri.Id); if (foundRedirectUri == null) { throw new Exception("RedirectUri not found"); } foundRedirectUri.RedirectUri = redirectUri.RedirectUri; return(this._configContext.Update(foundRedirectUri).Entity.Id); }