|
21 | 21 | from .throttled_http_client import ThrottledHttpClient |
22 | 22 | from .cloudshell import _is_running_in_cloud_shell |
23 | 23 | from .sku import SKU, __version__ |
24 | | - |
| 24 | +from .oauth2cli.authcode import is_wsl |
25 | 25 |
|
26 | 26 |
|
27 | 27 | logger = logging.getLogger(__name__) |
@@ -1929,13 +1929,14 @@ def __init__( |
1929 | 1929 | enable_broker_on_windows=None, |
1930 | 1930 | enable_broker_on_mac=None, |
1931 | 1931 | enable_broker_on_linux=None, |
| 1932 | + enable_broker_on_wsl=None, |
1932 | 1933 | **kwargs): |
1933 | 1934 | """Same as :func:`ClientApplication.__init__`, |
1934 | 1935 | except that ``client_credential`` parameter shall remain ``None``. |
1935 | 1936 |
|
1936 | 1937 | .. note:: |
1937 | 1938 |
|
1938 | | - You may set enable_broker_on_windows and/or enable_broker_on_mac and/or enable_broker_on_linux to True. |
| 1939 | + You may set enable_broker_on_windows and/or enable_broker_on_mac and/or enable_broker_on_linux and/or enable_broker_on_wsl to True. |
1939 | 1940 |
|
1940 | 1941 | **What is a broker, and why use it?** |
1941 | 1942 |
|
@@ -2011,13 +2012,21 @@ def __init__( |
2011 | 2012 | This parameter defaults to None, which means MSAL will not utilize a broker. |
2012 | 2013 |
|
2013 | 2014 | New in MSAL Python 1.32.0. |
| 2015 | +
|
| 2016 | + :param boolean enable_broker_on_wsl: |
| 2017 | + This setting is only effective if your app is running on WSL. |
| 2018 | + This parameter defaults to None, which means MSAL will not utilize a broker. |
| 2019 | +
|
| 2020 | + New in MSAL Python 1.32.0. |
2014 | 2021 | """ |
2015 | 2022 | if client_credential is not None: |
2016 | 2023 | raise ValueError("Public Client should not possess credentials") |
| 2024 | + |
2017 | 2025 | self._enable_broker = bool( |
2018 | 2026 | enable_broker_on_windows and sys.platform == "win32" |
2019 | 2027 | or enable_broker_on_mac and sys.platform == "darwin" |
2020 | | - or enable_broker_on_linux and sys.platform == "linux") |
| 2028 | + or (enable_broker_on_linux or (enable_broker_on_wsl and is_wsl())) and sys.platform == "linux") |
| 2029 | + |
2021 | 2030 | super(PublicClientApplication, self).__init__( |
2022 | 2031 | client_id, client_credential=None, **kwargs) |
2023 | 2032 |
|
|
0 commit comments