From bd4f5c7ef45e7a25f799a0aa434a04e58c0075a3 Mon Sep 17 00:00:00 2001 From: Danny Tsai Date: Tue, 20 Dec 2022 13:57:33 -0800 Subject: [PATCH] JsonWebTokenHandler to return the JsonWebToken on validation failure --- .../JsonWebTokenHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.cs b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.cs index 66a4627860..14f8be6c38 100644 --- a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.cs +++ b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebTokenHandler.cs @@ -1318,6 +1318,7 @@ private TokenValidationResult ValidateJWS(JsonWebToken jsonWebToken, TokenValida { return new TokenValidationResult { + SecurityToken = jsonWebToken, Exception = ex, IsValid = false }; @@ -1353,6 +1354,7 @@ private TokenValidationResult ValidateJWE(JsonWebToken jwtToken, TokenValidation { return new TokenValidationResult { + SecurityToken = jwtToken, Exception = ex, IsValid = false };