From 54ba505e0a4d726d76650244b2679c6a480df655 Mon Sep 17 00:00:00 2001 From: Brent Schmaltz Date: Fri, 1 Sep 2023 09:05:04 -0700 Subject: [PATCH] AddIssuerValidator return ValueTask. --- .../AadIssuerValidator/AadIssuerValidator.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.IdentityModel.Validators/AadIssuerValidator/AadIssuerValidator.cs b/src/Microsoft.IdentityModel.Validators/AadIssuerValidator/AadIssuerValidator.cs index 83090efa27..c173d38976 100644 --- a/src/Microsoft.IdentityModel.Validators/AadIssuerValidator/AadIssuerValidator.cs +++ b/src/Microsoft.IdentityModel.Validators/AadIssuerValidator/AadIssuerValidator.cs @@ -124,7 +124,10 @@ public string Validate( SecurityToken securityToken, TokenValidationParameters validationParameters) { - return ValidateAsync(issuer, securityToken, validationParameters).GetAwaiter().GetResult(); + ValueTask vt = ValidateAsync(issuer, securityToken, validationParameters); + return vt.IsCompletedSuccessfully ? + vt.Result : + vt.AsTask().GetAwaiter().GetResult(); } /// @@ -145,7 +148,7 @@ public string Validate( /// if is null. /// if is null. /// if the issuer is invalid or if there is a network issue. - internal async Task ValidateAsync( + internal async ValueTask ValidateAsync( string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters)