private async Task InvokeBackChannelClientsAsync(EndSessionCallbackValidationResult result) { if (result.BackChannelLogouts?.Any() == true) { // best-effort, and async to not block the response to the browser try { await _backChannelClient.SendLogoutsAsync(result.BackChannelLogouts); } catch (Exception ex) { _logger.LogError(ex, "Error calling backchannel sign-out urls"); } } }
public async Task ExecuteAsync(HttpContext context) { Init(context); if (_result.IsError) { context.Response.StatusCode = (int)HttpStatusCode.BadRequest; } else { context.Response.SetNoCache(); AddCspHeaders(context); var html = GetHtml(); await context.Response.WriteHtmlAsync(html); await context.Response.Body.FlushAsync(); // todo: discuss if we should do this before rendering/flushing // or even from a forked task await _backChannelClient.SendLogoutsAsync(_result.BackChannelLogouts); } }