Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Engel committed Jul 5, 2024
1 parent bad621f commit 939bcc4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ public override async Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthenti
using CancellationTokenSource cts = new();

// Use Connection timeout value to cancel token acquire request after certain period of time.
cts.CancelAfter(parameters.ConnectionTimeout * 1000); // Convert to milliseconds
int timeout = parameters.ConnectionTimeout * 1000;
if (timeout > 0) // if ConnectionTimeout is 0 or the above overflows an int, no need to set CancelAfter
{
cts.CancelAfter(parameters.ConnectionTimeout * 1000); // Convert to milliseconds
}

string scope = parameters.Resource.EndsWith(s_defaultScopeSuffix, StringComparison.Ordinal) ? parameters.Resource : parameters.Resource + s_defaultScopeSuffix;
string[] scopes = new string[] { scope };
Expand Down

0 comments on commit 939bcc4

Please sign in to comment.