Skip to content

Commit

Permalink
AddIssuerValidator return ValueTask. (#2287)
Browse files Browse the repository at this point in the history
Co-authored-by: Brent Schmaltz <[email protected]>
  • Loading branch information
brentschmaltz and Brent Schmaltz committed Sep 7, 2023
1 parent c73ce83 commit 22f23d0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ public string Validate(
SecurityToken securityToken,
TokenValidationParameters validationParameters)
{
return ValidateAsync(issuer, securityToken, validationParameters).GetAwaiter().GetResult();
ValueTask<string> vt = ValidateAsync(issuer, securityToken, validationParameters);
return vt.IsCompletedSuccessfully ?
vt.Result :
vt.AsTask().GetAwaiter().GetResult();
}

/// <summary>
Expand All @@ -145,7 +148,7 @@ public string Validate(
/// <exception cref="ArgumentNullException"> if <paramref name="securityToken"/> is null.</exception>
/// <exception cref="ArgumentNullException"> if <paramref name="validationParameters"/> is null.</exception>
/// <exception cref="SecurityTokenInvalidIssuerException">if the issuer is invalid or if there is a network issue. </exception>
internal async Task<string> ValidateAsync(
internal async ValueTask<string> ValidateAsync(
string issuer,
SecurityToken securityToken,
TokenValidationParameters validationParameters)
Expand Down

0 comments on commit 22f23d0

Please sign in to comment.