Skip to content

Commit 3ca5fcf

Browse files
committed
Address comments
1 parent f2df4f8 commit 3ca5fcf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

msal/application.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def _decide_broker(self, allow_broker, enable_pii_log):
705705

706706
def is_pop_supported(self):
707707
"""Returns True if this client supports Proof-of-Possession Access Token."""
708-
return self._enable_broker and sys.platform != "linux"
708+
return self._enable_broker and sys.platform in ("win32", "darwin")
709709

710710
def _decorate_scope(
711711
self, scopes,
@@ -1510,6 +1510,9 @@ def _acquire_token_silent_with_error(
15101510
}.get(final_result["suberror"], final_result["suberror"])
15111511
return final_result
15121512

1513+
def _is_ssh_cert_or_pop_request(token_type, auth_scheme) -> bool:
1514+
return token_type == "ssh-cert" or token_type == "pop" or isinstance(auth_scheme, msal.auth_scheme.PopAuthScheme)
1515+
15131516
def _acquire_token_silent_from_cache_and_possibly_refresh_it(
15141517
self,
15151518
scopes, # type: List[str]
@@ -1577,10 +1580,8 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
15771580
raise ValueError("auth_scheme is not supported in Cloud Shell")
15781581
return self._acquire_token_by_cloud_shell(scopes, data=data)
15791582

1580-
is_ssh_cert_or_pop_request = (
1581-
data.get("token_type") == "ssh-cert" or
1582-
data.get("token_type") == "pop" or
1583-
isinstance(auth_scheme, msal.auth_scheme.PopAuthScheme))
1583+
is_ssh_cert_or_pop_request = _is_ssh_cert_or_pop_request(data.get("token_type"), auth_scheme)
1584+
15841585
if self._enable_broker and account and account.get("account_source") in (
15851586
_GRANT_TYPE_BROKER, # Broker successfully established this account previously.
15861587
None, # Unknown data from older MSAL. Broker might still work.
@@ -1928,6 +1929,7 @@ def __init__(
19281929
*,
19291930
enable_broker_on_windows=None,
19301931
enable_broker_on_mac=None,
1932+
enable_broker_on_linux=None,
19311933
**kwargs):
19321934
"""Same as :func:`ClientApplication.__init__`,
19331935
except that ``client_credential`` parameter shall remain ``None``.
@@ -2144,11 +2146,9 @@ def acquire_token_interactive(
21442146
# https://microsoft.sharepoint.com/:w:/t/Identity-DevEx/EatIUauX3c9Ctw1l7AQ6iM8B5CeBZxc58eoQCE0IuZ0VFw?e=tgc3jP&CID=39c853be-76ea-79d7-ee73-f1b2706ede05
21452147
False
21462148
) and data.get("token_type") != "ssh-cert" # Work around a known issue as of PyMsalRuntime 0.8
2147-
self._validate_ssh_cert_input_data(data)
2148-
is_ssh_cert_or_pop_request = (
2149-
data.get("token_type") == "ssh-cert" or
2150-
data.get("token_type") == "pop" or
2151-
isinstance(auth_scheme, msal.auth_scheme.PopAuthScheme))
2149+
self._validate_ssh_cert_input_data(data)
2150+
is_ssh_cert_or_pop_request = _is_ssh_cert_or_pop_request(data.get("token_type"), auth_scheme)
2151+
21522152
if not on_before_launching_ui:
21532153
on_before_launching_ui = lambda **kwargs: None
21542154
if _is_running_in_cloud_shell() and prompt == "none":

0 commit comments

Comments
 (0)