From a3b2d0888c19b6475afc8bda45d9be3833424923 Mon Sep 17 00:00:00 2001 From: Tim Starbuck Date: Mon, 3 May 2021 14:26:25 -0500 Subject: [PATCH] default HashAlgorithm to RS256 to support MS Azure AD --- src/JwksFeature.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/JwksFeature.cs b/src/JwksFeature.cs index a4985e7..d4f0ded 100644 --- a/src/JwksFeature.cs +++ b/src/JwksFeature.cs @@ -46,10 +46,8 @@ protected virtual void LoadKeySet(JsonWebKeySetResponse keySet) { if (JwtAuthProvider.RequireHashAlgorithm) { // infer the algorithm if it is described by a key from the set - var algo = keySet.Keys.FirstOrDefault(x => !string.IsNullOrEmpty(x.Algorithm))? .Algorithm; - if (algo != null) { - JwtAuthProvider.HashAlgorithm = algo; - } + var algo = keySet.Keys.FirstOrDefault(x => !string.IsNullOrEmpty(x.Algorithm))?.Algorithm; + JwtAuthProvider.HashAlgorithm = algo ?? "RS256"; } var key = keySet.Keys.First();