Skip to content

Commit a79cb99

Browse files
ashok672Copilot
andcommitted
Address review feedback on Intel-Mac broker gate
- Document that enable_broker_on_mac requires Apple Silicon (arm64) and that Intel Macs fall back to non-broker. - Smoke test: opt in only via enable_broker_on_mac, so the script no longer reports a false failure on Windows/Linux hosts where the broker prerequisites are met. - Keep the decorator stack contiguous by moving the explanatory comment onto the decorator line it describes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 18d12f9 commit a79cb99

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎msal/application.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,7 +2187,7 @@ def __init__(
21872187
+--------------------------+-----------------------------------+------------------------------------------------------------------------------------+
21882188
| enable_broker_on_wsl | WSL | ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id |
21892189
+--------------------------+-----------------------------------+------------------------------------------------------------------------------------+
2190-
| enable_broker_on_mac | Mac with Company Portal installed | msauth.com.msauth.unsignedapp://auth |
2190+
| enable_broker_on_mac | Apple Silicon Mac, Company Portal | msauth.com.msauth.unsignedapp://auth |
21912191
+--------------------------+-----------------------------------+------------------------------------------------------------------------------------+
21922192
| enable_broker_on_linux | Linux with Intune installed | ``https://login.microsoftonline.com/common/oauth2/nativeclient`` (MUST be enabled) |
21932193
+--------------------------+-----------------------------------+------------------------------------------------------------------------------------+
@@ -2227,7 +2227,10 @@ def __init__(
22272227
New in MSAL Python 1.25.0.
22282228
22292229
:param boolean enable_broker_on_mac:
2230-
This setting is only effective if your app is running on Mac.
2230+
This setting is only effective if your app is running on
2231+
an Apple Silicon (arm64) Mac.
2232+
Broker is not supported on Intel-based Macs, where this setting
2233+
is ignored and MSAL will fall back to non-broker.
22312234
This parameter defaults to None, which means MSAL will not utilize a broker.
22322235
22332236
New in MSAL Python 1.31.0.

‎tests/intel_mac_broker_smoke_test.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def main():
5252
app = msal.PublicClientApplication(
5353
_CLIENT_ID,
5454
authority=_AUTHORITY,
55-
enable_broker_on_mac=True,
56-
enable_broker_on_windows=True,
57-
enable_broker_on_linux=True,
55+
enable_broker_on_mac=True, # Only opt in on Mac; this script validates the Mac gate.
5856
)
5957
actual = bool(app._enable_broker)
6058
print(f"Actual _enable_broker = {actual}")

‎tests/test_application.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,8 +1621,7 @@ def test_client_id_should_be_a_valid_scope(self):
16211621

16221622

16231623
@patch("sys.platform", new="darwin") # Pretend running on Mac.
1624-
@patch("msal.application.platform.machine", new=Mock(return_value="arm64"))
1625-
# Pretend Apple Silicon, because broker is not supported on Intel-based Macs.
1624+
@patch("msal.application.platform.machine", new=Mock(return_value="arm64")) # Pretend Apple Silicon, because broker is not supported on Intel-based Macs.
16261625
@patch("msal.authority.tenant_discovery", new=Mock(return_value={
16271626
"authorization_endpoint": "https://contoso.com/placeholder",
16281627
"token_endpoint": "https://contoso.com/placeholder",
@@ -1665,8 +1664,7 @@ def test_should_fallback_when_pymsalruntime_failed_to_initialize_broker(self):
16651664

16661665

16671666
@patch("sys.platform", new="darwin") # Pretend running on Mac.
1668-
@patch("msal.application.platform.machine", new=Mock(return_value="arm64"))
1669-
# Pretend Apple Silicon, because broker is not supported on Intel-based Macs.
1667+
@patch("msal.application.platform.machine", new=Mock(return_value="arm64")) # Pretend Apple Silicon, because broker is not supported on Intel-based Macs.
16701668
@patch("msal.authority.tenant_discovery", new=Mock(return_value={
16711669
"authorization_endpoint": "https://contoso.com/placeholder",
16721670
"token_endpoint": "https://contoso.com/placeholder",

0 commit comments

Comments
 (0)