From 663a7986ccfdb3a784d9210cc4572932a41c002c Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Thu, 14 Dec 2023 11:11:08 -0600 Subject: [PATCH] Fix failing test --- .../Stores/Default/DefaultUserConsentStore.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/IdentityServer/Stores/Default/DefaultUserConsentStore.cs b/src/IdentityServer/Stores/Default/DefaultUserConsentStore.cs index 5dab9f5ec..bb98ef06b 100644 --- a/src/IdentityServer/Stores/Default/DefaultUserConsentStore.cs +++ b/src/IdentityServer/Stores/Default/DefaultUserConsentStore.cs @@ -71,8 +71,11 @@ public async Task GetUserConsentAsync(string subjectId, string clientId { var legacyKey = GetConsentKey(subjectId, clientId, useHexEncoding: false); consent = await GetItemAsync(legacyKey); - await StoreUserConsentAsync(consent); // Write back the consent record to update its key - await RemoveItemAsync(legacyKey); + if(consent != null) + { + await StoreUserConsentAsync(consent); // Write back the consent record to update its key + await RemoveItemAsync(legacyKey); + } } return consent;