private async Task <IEnumerable <string> > GetClientEndSessionUrlsAsync() { // read client list to get URLs for client logout endpoints var clientIds = _clientListCookie.GetClients(); // Fetch the Clients for each clientid var clients = new List <Client>(); foreach (var clientId in clientIds) { var client = await _clientStore.FindClientByIdAsync(clientId); if (client != null) { clients.Add(client); } } // get user's session id. session id will possibly // be needed below to pass to client's endpoint var sid = _sessionCookie.GetSessionId(); var urls = new List <string>(); foreach (var client in clients) { if (client.LogoutUri.IsPresent()) { var url = client.LogoutUri; // add session id if required if (client.LogoutSessionRequired) { url = url.AddQueryString(Constants.ClaimTypes.SessionId + "=" + sid); } urls.Add(url); } } return(urls); }
private async Task <IEnumerable <string> > GetClientEndSessionUrlsAsync() { // read client list to get URLs for client logout endpoints var clientIds = _clientListCookie.GetClients(); // fetch the clients in parallel var tasks = from clientId in clientIds select _clientStore.FindClientByIdAsync(clientId); await Task.WhenAll(tasks); // get clients located and build the iframe urls var clients = tasks.Select(x => x.Result); // get user's session id. session id will possibly // be needed below to pass to client's endpoint var sid = _sessionCookie.GetSessionId(); var urls = new List <string>(); foreach (var client in clients) { if (client.LogoutUri.IsPresent()) { var url = client.LogoutUri; // add session id if required if (client.LogoutSessionRequired) { url = url.AddQueryString(Constants.ClaimTypes.SessionId + "=" + sid); } urls.Add(url); } } return(urls); }
private async Task <IEnumerable <string> > GetClientEndSessionUrlsAsync(string sid) { // read client list to get URLs for client logout endpoints var clientIds = _clientListCookie.GetClients(); var urls = new List <string>(); foreach (var clientId in clientIds) { var client = await _clientStore.FindClientByIdAsync(clientId); if (client != null && client.LogoutUri.IsPresent()) { var url = client.LogoutUri; // add session id if required if (client.LogoutSessionRequired) { //TODO: update sid to OidcConstants when idmodel released url = url.AddQueryString("sid" + "=" + sid); } urls.Add(url); } } if (urls.Any()) { var msg = urls.Aggregate((x, y) => x + ", " + y); _logger.LogDebug("Client end session iframe URLs: {0}", msg); } else { _logger.LogDebug("No client end session iframe URLs"); } return(urls); }