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)