From ccb9a5e2a750f298b406034c6134970ade05d92b Mon Sep 17 00:00:00 2001 From: rpetz Date: Mon, 28 Nov 2016 21:32:04 -0800 Subject: [PATCH] Adds the expected signature data to the SignatureVerificationException's data dictionary --- src/JWT/JWT.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/JWT/JWT.cs b/src/JWT/JWT.cs index 9fb449737..e6f87d13b 100644 --- a/src/JWT/JWT.cs +++ b/src/JWT/JWT.cs @@ -239,7 +239,10 @@ public static void Verify(string payloadJson, string decodedCrypto, string decod { if (decodedCrypto != decodedSignature) { - throw new SignatureVerificationException("Invalid signature"); + var signatureVerificationException = new SignatureVerificationException("Invalid signature"); + signatureVerificationException.Data.Add("Expected", decodedCrypto); + signatureVerificationException.Data.Add("Received", decodedSignature); + throw signatureVerificationException; } // verify exp claim https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.4