Skip to content

Commit d2fc35f

Browse files
committed
Enable broker support on Linux
1 parent 7db6c2c commit d2fc35f

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

msal/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def _main():
300300
instance_discovery=instance_discovery,
301301
enable_broker_on_windows=enable_broker,
302302
enable_broker_on_mac=enable_broker,
303+
enable_broker_on_linux=enable_broker,
303304
enable_pii_log=enable_pii_log,
304305
token_cache=global_cache,
305306
) if not is_cca else msal.ConfidentialClientApplication(

msal/application.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ def _decide_broker(self, allow_broker, enable_pii_log):
672672
"allow_broker is deprecated. "
673673
"Please use PublicClientApplication(..., "
674674
"enable_broker_on_windows=True, "
675+
"enable_broker_on_linux=True, "
675676
"enable_broker_on_mac=...)",
676677
DeprecationWarning)
677678
opted_in_for_broker = (
@@ -1921,7 +1922,7 @@ def __init__(self, client_id, client_credential=None, **kwargs):
19211922
19221923
.. note::
19231924
1924-
You may set enable_broker_on_windows and/or enable_broker_on_mac to True.
1925+
You may set enable_broker_on_windows and/or enable_broker_on_mac and/or enable_broker_on_linux to True.
19251926
19261927
**What is a broker, and why use it?**
19271928
@@ -1989,6 +1990,12 @@ def __init__(self, client_id, client_credential=None, **kwargs):
19891990
This parameter defaults to None, which means MSAL will not utilize a broker.
19901991
19911992
New in MSAL Python 1.31.0.
1993+
1994+
:param boolean enable_broker_on_linux:
1995+
This setting is only effective if your app is running on Linux.
1996+
This parameter defaults to None, which means MSAL will not utilize a broker.
1997+
1998+
New in MSAL Python 1.32.0.
19921999
"""
19932000
if client_credential is not None:
19942001
raise ValueError("Public Client should not possess credentials")

sample/interactive_sample.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
oidc_authority=os.getenv('OIDC_AUTHORITY'), # For External ID with custom domain
4848
#enable_broker_on_windows=True, # Opted in. You will be guided to meet the prerequisites, if your app hasn't already
4949
#enable_broker_on_mac=True, # Opted in. You will be guided to meet the prerequisites, if your app hasn't already
50-
50+
#enable_broker_on_linux=True, # Opted in. You will be guided to meet the prerequisites, if your app hasn't already
51+
5152
token_cache=global_token_cache, # Let this app (re)use an existing token cache.
5253
# If absent, ClientApplication will create its own empty token cache
5354
)

setup.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ broker =
6262
# most existing MSAL Python apps do not have the redirect_uri needed by broker.
6363
#
6464
# We need pymsalruntime.CallbackData introduced in PyMsalRuntime 0.14
65-
pymsalruntime>=0.14,<0.18; python_version>='3.6' and platform_system=='Windows'
65+
pymsalruntime>=0.14,<0.19; python_version>='3.6' and platform_system=='Windows'
6666
# On Mac, PyMsalRuntime 0.17+ is expected to support SSH cert and ROPC
67-
pymsalruntime>=0.17,<0.18; python_version>='3.8' and platform_system=='Darwin'
67+
pymsalruntime>=0.17,<0.19; python_version>='3.8' and platform_system=='Darwin'
68+
# PyMsalRuntime 0.18+ is expected to support broker on Linux
69+
pymsalruntime>=0.18,<0.19; python_version>='3.8' and platform_system=='Linux'
6870

6971
[options.packages.find]
7072
exclude =

tests/broker-test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
_AZURE_CLI,
4040
authority="https://login.microsoftonline.com/organizations",
4141
enable_broker_on_mac=True,
42-
enable_broker_on_windows=True)
42+
enable_broker_on_windows=True,
43+
enable_broker_on_linux=True)
4344

4445
def interactive_and_silent(scopes, auth_scheme, data, expected_token_type):
4546
print("An account picker shall be pop up, possibly behind this console. Continue from there.")

tests/test_e2e.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def _build_app(cls,
200200
http_client=http_client or MinimalHttpClient(),
201201
enable_broker_on_windows=broker_available,
202202
enable_broker_on_mac=broker_available,
203+
enable_broker_on_linux=broker_available,
203204
)
204205

205206
def _test_username_password(self,

0 commit comments

Comments
 (0)