|
4 | 4 |
|
5 | 5 | using System;
|
6 | 6 | using System.Collections.Generic;
|
| 7 | +using System.Data; |
7 | 8 | using System.Data.Common;
|
8 | 9 | using System.Diagnostics;
|
9 | 10 | using System.Diagnostics.CodeAnalysis;
|
|
14 | 15 | using System.Text;
|
15 | 16 | using System.Threading;
|
16 | 17 | using System.Threading.Tasks;
|
17 |
| -using System.Transactions; |
18 | 18 | using Microsoft.Data.Common;
|
19 | 19 | using Microsoft.Data.ProviderBase;
|
20 | 20 | using Microsoft.Data.SqlClient.ConnectionPool;
|
21 | 21 | using Microsoft.Identity.Client;
|
| 22 | +using System.Transactions; |
22 | 23 |
|
23 | 24 |
|
24 | 25 | namespace Microsoft.Data.SqlClient
|
@@ -136,7 +137,7 @@ sealed internal class SqlInternalConnectionTds : SqlInternalConnection, IDisposa
|
136 | 137 | // The Federated Authentication returned by TryGetFedAuthTokenLocked or GetFedAuthToken.
|
137 | 138 | SqlFedAuthToken _fedAuthToken = null;
|
138 | 139 | internal byte[] _accessTokenInBytes;
|
139 |
| - internal readonly Func<SqlAuthenticationParameters, CancellationToken, Task<SqlAuthenticationToken>> _accessTokenCallback; |
| 140 | + internal readonly Func<SqlAuthenticationParameters, CancellationToken,Task<SqlAuthenticationToken>> _accessTokenCallback; |
140 | 141 |
|
141 | 142 | private readonly ActiveDirectoryAuthenticationTimeoutRetryHelper _activeDirectoryAuthTimeoutRetryHelper;
|
142 | 143 |
|
@@ -1516,12 +1517,12 @@ private void OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectio
|
1516 | 1517 | else
|
1517 | 1518 | {
|
1518 | 1519 | _timeoutErrorInternal.SetFailoverScenario(false); // not a failover scenario
|
1519 |
| - LoginNoFailover(dataSource, |
1520 |
| - newPassword, |
1521 |
| - newSecurePassword, |
| 1520 | + LoginNoFailover(dataSource, |
| 1521 | + newPassword, |
| 1522 | + newSecurePassword, |
1522 | 1523 | redirectedUserInstance,
|
1523 |
| - connectionOptions, |
1524 |
| - credential, |
| 1524 | + connectionOptions, |
| 1525 | + credential, |
1525 | 1526 | timeout);
|
1526 | 1527 | }
|
1527 | 1528 |
|
@@ -2490,7 +2491,7 @@ internal void OnFedAuthInfo(SqlFedAuthInfo fedAuthInfo)
|
2490 | 2491 |
|
2491 | 2492 | if (_newDbConnectionPoolAuthenticationContext != null)
|
2492 | 2493 | {
|
2493 |
| - _dbConnectionPool.AuthenticationContexts.TryAdd(_dbConnectionPoolAuthenticationContextKey, _newDbConnectionPoolAuthenticationContext); |
| 2494 | + _dbConnectionPool.AuthenticationContexts.TryAdd(_dbConnectionPoolAuthenticationContextKey, _newDbConnectionPoolAuthenticationContext); |
2494 | 2495 | }
|
2495 | 2496 | }
|
2496 | 2497 | }
|
@@ -2604,10 +2605,13 @@ internal SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo)
|
2604 | 2605 | try
|
2605 | 2606 | {
|
2606 | 2607 | var authParamsBuilder = new SqlAuthenticationParameters.Builder(
|
2607 |
| - connection: this, |
| 2608 | + authenticationMethod: ConnectionOptions.Authentication, |
2608 | 2609 | resource: fedAuthInfo.spn,
|
2609 |
| - authority: fedAuthInfo.stsurl); |
2610 |
| - |
| 2610 | + authority: fedAuthInfo.stsurl, |
| 2611 | + serverName: ConnectionOptions.DataSource, |
| 2612 | + databaseName: ConnectionOptions.InitialCatalog) |
| 2613 | + .WithConnectionId(_clientConnectionId) |
| 2614 | + .WithConnectionTimeout(ConnectionOptions.ConnectTimeout); |
2611 | 2615 | switch (ConnectionOptions.Authentication)
|
2612 | 2616 | {
|
2613 | 2617 | case SqlAuthenticationMethod.ActiveDirectoryIntegrated:
|
|
0 commit comments