From 4f8f3cdee9fe4902f7f1924d69251e87d8ab61d0 Mon Sep 17 00:00:00 2001 From: Andriy Tolstoy Date: Mon, 12 Aug 2024 13:04:36 +0200 Subject: [PATCH 1/2] remove unnecessary distinct method --- src/IdentityServer/Extensions/HttpContextExtensions.cs | 1 - .../Services/Default/DefaultPersistedGrantService.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/IdentityServer/Extensions/HttpContextExtensions.cs b/src/IdentityServer/Extensions/HttpContextExtensions.cs index e24d85607..001a50370 100644 --- a/src/IdentityServer/Extensions/HttpContextExtensions.cs +++ b/src/IdentityServer/Extensions/HttpContextExtensions.cs @@ -46,7 +46,6 @@ internal static async Task GetIdentityServerSignoutFrameCallbackUrlAsync if (currentSubId == logoutMessage?.SubjectId) { clientIds = clientIds.Union(await userSession.GetClientListAsync()); - clientIds = clientIds.Distinct(); } endSessionMsg = new LogoutNotificationContext diff --git a/src/IdentityServer/Services/Default/DefaultPersistedGrantService.cs b/src/IdentityServer/Services/Default/DefaultPersistedGrantService.cs index 362181a06..a15f5b4d5 100644 --- a/src/IdentityServer/Services/Default/DefaultPersistedGrantService.cs +++ b/src/IdentityServer/Services/Default/DefaultPersistedGrantService.cs @@ -144,7 +144,7 @@ private IEnumerable Join(IEnumerable first, IEnumerable sec var match = list.FirstOrDefault(x => x.ClientId == other.ClientId); if (match != null) { - match.Scopes = match.Scopes.Union(other.Scopes).Distinct(); + match.Scopes = match.Scopes.Union(other.Scopes); if (match.CreationTime > other.CreationTime) { From e7b92790ecad76fcbd1ad1c2dd290f45cf4de5c4 Mon Sep 17 00:00:00 2001 From: Andriy Tolstoy Date: Mon, 19 Aug 2024 13:56:10 +0200 Subject: [PATCH 2/2] remove unnecessary check for null --- src/IdentityServer/Extensions/HttpContextExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IdentityServer/Extensions/HttpContextExtensions.cs b/src/IdentityServer/Extensions/HttpContextExtensions.cs index 001a50370..fa058214a 100644 --- a/src/IdentityServer/Extensions/HttpContextExtensions.cs +++ b/src/IdentityServer/Extensions/HttpContextExtensions.cs @@ -40,10 +40,10 @@ internal static async Task GetIdentityServerSignoutFrameCallbackUrlAsync // if we have a logout message, then that take precedence over the current user if (logoutMessage?.ClientIds?.Any() == true) { - var clientIds = logoutMessage?.ClientIds; + var clientIds = logoutMessage.ClientIds; // check if current user is same, since we might have new clients (albeit unlikely) - if (currentSubId == logoutMessage?.SubjectId) + if (currentSubId == logoutMessage.SubjectId) { clientIds = clientIds.Union(await userSession.GetClientListAsync()); }