@@ -701,7 +701,7 @@ def _decide_broker(self, allow_broker, enable_pii_log):
701
701
702
702
def is_pop_supported (self ):
703
703
"""Returns True if this client supports Proof-of-Possession Access Token."""
704
- return self ._enable_broker
704
+ return self ._enable_broker and sys . platform != "linux"
705
705
706
706
def _decorate_scope (
707
707
self , scopes ,
@@ -1438,6 +1438,7 @@ def acquire_token_silent_with_error(
1438
1438
- None when there is simply no token in the cache.
1439
1439
- A dict containing an "error" key, when token refresh failed.
1440
1440
"""
1441
+ print ("dharshanb acquire_token_silent_with_error line 1441" )
1441
1442
if not account :
1442
1443
return None # A backward-compatible NO-OP to drop the account=None usage
1443
1444
return _clean_up (self ._acquire_token_silent_with_error (
@@ -1453,6 +1454,7 @@ def _acquire_token_silent_with_error(
1453
1454
claims_challenge = None ,
1454
1455
auth_scheme = None ,
1455
1456
** kwargs ):
1457
+ print ("dharshanb _acquire_token_silent_with_error line 1457" )
1456
1458
assert isinstance (scopes , list ), "Invalid parameter type"
1457
1459
self ._validate_ssh_cert_input_data (kwargs .get ("data" , {}))
1458
1460
correlation_id = msal .telemetry ._get_new_correlation_id ()
@@ -1520,6 +1522,7 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
1520
1522
# This internal method has two calling patterns:
1521
1523
# it accepts a non-empty account to find token for a user,
1522
1524
# and accepts account=None to find a token for the current app.
1525
+ print ("dharshanb _acquire_token_silent_from_cache_and_possibly_refresh_it line 1525" )
1523
1526
access_token_from_cache = None
1524
1527
if not (force_refresh or claims_challenge or auth_scheme ): # Then attempt AT cache
1525
1528
query = {
@@ -1573,11 +1576,16 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
1573
1576
raise ValueError ("auth_scheme is not supported in Cloud Shell" )
1574
1577
return self ._acquire_token_by_cloud_shell (scopes , data = data )
1575
1578
1579
+ is_ssh_cert_or_pop_request = (
1580
+ data .get ("token_type" ) == "ssh-cert" or
1581
+ data .get ("token_type" ) == "pop" or
1582
+ isinstance (auth_scheme , msal .auth_scheme .PopAuthScheme ))
1576
1583
if self ._enable_broker and account and account .get ("account_source" ) in (
1577
1584
_GRANT_TYPE_BROKER , # Broker successfully established this account previously.
1578
1585
None , # Unknown data from older MSAL. Broker might still work.
1579
- ):
1586
+ ) and ( sys . platform != "linux" or not is_ssh_cert_or_pop_request ) :
1580
1587
from .broker import _acquire_token_silently
1588
+ print ("dharshanb .broker import _acquire_token_silently line 1584" )
1581
1589
response = _acquire_token_silently (
1582
1590
"https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
1583
1591
self .client_id ,
@@ -1823,7 +1831,8 @@ def acquire_token_by_username_password(
1823
1831
"""
1824
1832
claims = _merge_claims_challenge_and_capabilities (
1825
1833
self ._client_capabilities , claims_challenge )
1826
- if self ._enable_broker :
1834
+ # dharshanb
1835
+ if self ._enable_broker and sys .platform != "linux" :
1827
1836
from .broker import _signin_silently
1828
1837
response = _signin_silently (
1829
1838
"https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
@@ -2121,6 +2130,7 @@ def acquire_token_interactive(
2121
2130
and typically contains an "access_token" key.
2122
2131
- A dict containing an "error" key, when token refresh failed.
2123
2132
"""
2133
+ print ("dharshanb acquire_token_interactive application.py" )
2124
2134
data = kwargs .pop ("data" , {})
2125
2135
enable_msa_passthrough = kwargs .pop ( # MUST remove it from kwargs
2126
2136
"enable_msa_passthrough" , # Keep it as a hidden param, for now.
@@ -2134,6 +2144,11 @@ def acquire_token_interactive(
2134
2144
False
2135
2145
) and data .get ("token_type" ) != "ssh-cert" # Work around a known issue as of PyMsalRuntime 0.8
2136
2146
self ._validate_ssh_cert_input_data (data )
2147
+ print ("dharshanb data.get(token_type)" , data .get ("token_type" ))
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 ))
2137
2152
if not on_before_launching_ui :
2138
2153
on_before_launching_ui = lambda ** kwargs : None
2139
2154
if _is_running_in_cloud_shell () and prompt == "none" :
@@ -2142,7 +2157,10 @@ def acquire_token_interactive(
2142
2157
return self ._acquire_token_by_cloud_shell (scopes , data = data )
2143
2158
claims = _merge_claims_challenge_and_capabilities (
2144
2159
self ._client_capabilities , claims_challenge )
2145
- if self ._enable_broker :
2160
+ print ("dharshanb sys.platform" , sys .platform )
2161
+ print ("dharshanb is_ssh_cert_or_pop_request" , is_ssh_cert_or_pop_request )
2162
+ if self ._enable_broker and (sys .platform != "linux" or not is_ssh_cert_or_pop_request ):
2163
+ print ("dharshanb self._enable_broker and (sys.platform != linux or not is_ssh_cert_or_pop_request)" )
2146
2164
if parent_window_handle is None :
2147
2165
raise ValueError (
2148
2166
"parent_window_handle is required when you opted into using broker. "
@@ -2167,8 +2185,11 @@ def acquire_token_interactive(
2167
2185
)
2168
2186
return self ._process_broker_response (response , scopes , data )
2169
2187
2170
- if auth_scheme :
2188
+ if isinstance (auth_scheme , msal .auth_scheme .PopAuthScheme ) and sys .platform == "linux" :
2189
+ raise ValueError ("POP is not supported on Linux" )
2190
+ elif auth_scheme :
2171
2191
raise ValueError (self ._AUTH_SCHEME_UNSUPPORTED )
2192
+
2172
2193
on_before_launching_ui (ui = "browser" )
2173
2194
telemetry_context = self ._build_telemetry_context (
2174
2195
self .ACQUIRE_TOKEN_INTERACTIVE )
0 commit comments