Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mssql_python/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ def process_auth_parameters(parameters: list) -> Tuple[list, Optional[str]]:
if key_lower == "authentication":
# Check for supported authentication types and set auth_type accordingly
if value_lower == AuthType.INTERACTIVE.value:
auth_type = "interactive"
# Interactive authentication (browser-based); only append parameter for non-Windows
if platform.system().lower() == "windows":
continue # Skip adding this parameter for Windows
auth_type = "interactive"
auth_type = None # Let Windows handle AADInteractive natively

elif value_lower == AuthType.DEVICE_CODE.value:
# Device code authentication (for devices without browser)
auth_type = "devicecode"
Expand Down
9 changes: 4 additions & 5 deletions tests/test_008_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,23 @@ def test_interactive_auth_windows(self, monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Windows")
params = ["Authentication=ActiveDirectoryInteractive", "Server=test"]
modified_params, auth_type = process_auth_parameters(params)
assert "Authentication=ActiveDirectoryInteractive" not in modified_params
assert "Authentication=ActiveDirectoryInteractive" in modified_params
assert auth_type == None

def test_interactive_auth_non_windows(self, monkeypatch):
monkeypatch.setattr(platform, "system", lambda: "Darwin")
params = ["Authentication=ActiveDirectoryInteractive", "Server=test"]
modified_params, auth_type = process_auth_parameters(params)
assert "Authentication=ActiveDirectoryInteractive" in modified_params
_, auth_type = process_auth_parameters(params)
assert auth_type == "interactive"

def test_device_code_auth(self):
params = ["Authentication=ActiveDirectoryDeviceCode", "Server=test"]
modified_params, auth_type = process_auth_parameters(params)
_, auth_type = process_auth_parameters(params)
assert auth_type == "devicecode"

def test_default_auth(self):
params = ["Authentication=ActiveDirectoryDefault", "Server=test"]
modified_params, auth_type = process_auth_parameters(params)
_, auth_type = process_auth_parameters(params)
assert auth_type == "default"

class TestRemoveSensitiveParams:
Expand Down