File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 99import sys
1010import warnings
1111from threading import Lock
12+ import os
1213
1314import requests
1415
2728
2829logger = logging .getLogger (__name__ )
2930
31+ if True : # Prefer launching Edge when running on Linux to support device-based CA.
32+ # This section only works when being run before webbrowser.open().
33+ # We could theoretically put it inside acquire_token_interactive(),
34+ # but that won't work for some of our major downstream applications
35+ # because they happen to invoke webbrowser.open() before calling MSAL.
36+ # So, we choose to add this logic at MSAL's module level.
37+ if ("BROWSER" not in os .environ # Customize it when end user has no preference
38+ and sys .platform == "linux" ): # On Linux, only Edge will have CA support
39+ os .environ ["BROWSER" ] = ( # This is the executable file name
40+ # Hard-coding a well-known location can avoid unwittingly invoking
41+ # a potentially malicious "microsoft-edge" in current working directory.
42+ "/usr/bin/microsoft-edge" )
43+ # Unavailable browser will be silently ignored and fall back to the default
44+ # More details at https://docs.python.org/3/library/webbrowser.html
45+ logger .debug ("Prefer %s as browser for sign-in." , os .environ .get ("BROWSER" ))
46+
3047
3148def extract_certs (public_cert_content ):
3249 # Parses raw public certificate file contents and returns a list of strings
You can’t perform that action at this time.
0 commit comments