From 64ae13b5893d80b494c6221858c01726d4fb9605 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 7 Jun 2024 15:36:01 +0500 Subject: [PATCH] identity: handle crash on introspection when user is null --- .../Services/CustomIntrospectionResponseGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Streetwriters.Identity/Services/CustomIntrospectionResponseGenerator.cs b/Streetwriters.Identity/Services/CustomIntrospectionResponseGenerator.cs index 92342c8..33fc89e 100644 --- a/Streetwriters.Identity/Services/CustomIntrospectionResponseGenerator.cs +++ b/Streetwriters.Identity/Services/CustomIntrospectionResponseGenerator.cs @@ -46,6 +46,7 @@ namespace Streetwriters.Identity.Services if (result.TryGetValue("sub", out object userId)) { var user = await UserManager.FindByIdAsync(userId.ToString()); + if (user == null || user.Claims == null) return result; var verifiedClaim = user.Claims.Find((c) => c.ClaimType == "verified"); if (verifiedClaim != null)