Skip to content

Commit

Permalink
Avoid "early" access to SqlAuthenticationProviderManager.Instance (#2636
Browse files Browse the repository at this point in the history
)
  • Loading branch information
0xced authored Jul 26, 2024
1 parent 38ce399 commit 0c45198
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ internal sealed class SqlInternalConnectionTds : SqlInternalConnection, IDisposa
internal readonly Func<SqlAuthenticationParameters, CancellationToken,Task<SqlAuthenticationToken>> _accessTokenCallback;

private readonly ActiveDirectoryAuthenticationTimeoutRetryHelper _activeDirectoryAuthTimeoutRetryHelper;
private readonly SqlAuthenticationProviderManager _sqlAuthenticationProviderManager;

internal bool _cleanSQLDNSCaching = false;
private bool _serverSupportsDNSCaching = false;
Expand Down Expand Up @@ -484,7 +483,6 @@ internal SqlInternalConnectionTds(
_accessTokenCallback = accessTokenCallback;

_activeDirectoryAuthTimeoutRetryHelper = new ActiveDirectoryAuthenticationTimeoutRetryHelper();
_sqlAuthenticationProviderManager = SqlAuthenticationProviderManager.Instance;

_identity = identity;
Debug.Assert(newSecurePassword != null || newPassword != null, "cannot have both new secure change password and string based change password to be null");
Expand Down Expand Up @@ -2362,7 +2360,7 @@ internal SqlFedAuthToken GetFedAuthToken(SqlFedAuthInfo fedAuthInfo)
// Username to use in error messages.
string username = null;

var authProvider = _sqlAuthenticationProviderManager.GetProvider(ConnectionOptions.Authentication);
var authProvider = SqlAuthenticationProvider.GetProvider(ConnectionOptions.Authentication);
if (authProvider == null && _accessTokenCallback == null)
throw SQL.CannotFindAuthProvider(ConnectionOptions.Authentication.ToString());

Expand Down

0 comments on commit 0c45198

Please sign in to comment.