@@ -701,7 +701,7 @@ def _decide_broker(self, allow_broker, enable_pii_log):
701701
702702 def is_pop_supported (self ):
703703 """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"
705705
706706 def _decorate_scope (
707707 self , scopes ,
@@ -1438,6 +1438,7 @@ def acquire_token_silent_with_error(
14381438 - None when there is simply no token in the cache.
14391439 - A dict containing an "error" key, when token refresh failed.
14401440 """
1441+ print ("dharshanb acquire_token_silent_with_error line 1441" )
14411442 if not account :
14421443 return None # A backward-compatible NO-OP to drop the account=None usage
14431444 return _clean_up (self ._acquire_token_silent_with_error (
@@ -1453,6 +1454,7 @@ def _acquire_token_silent_with_error(
14531454 claims_challenge = None ,
14541455 auth_scheme = None ,
14551456 ** kwargs ):
1457+ print ("dharshanb _acquire_token_silent_with_error line 1457" )
14561458 assert isinstance (scopes , list ), "Invalid parameter type"
14571459 self ._validate_ssh_cert_input_data (kwargs .get ("data" , {}))
14581460 correlation_id = msal .telemetry ._get_new_correlation_id ()
@@ -1520,6 +1522,7 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
15201522 # This internal method has two calling patterns:
15211523 # it accepts a non-empty account to find token for a user,
15221524 # 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" )
15231526 access_token_from_cache = None
15241527 if not (force_refresh or claims_challenge or auth_scheme ): # Then attempt AT cache
15251528 query = {
@@ -1573,11 +1576,16 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
15731576 raise ValueError ("auth_scheme is not supported in Cloud Shell" )
15741577 return self ._acquire_token_by_cloud_shell (scopes , data = data )
15751578
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 ))
15761583 if self ._enable_broker and account and account .get ("account_source" ) in (
15771584 _GRANT_TYPE_BROKER , # Broker successfully established this account previously.
15781585 None , # Unknown data from older MSAL. Broker might still work.
1579- ):
1586+ ) and ( sys . platform != "linux" or not is_ssh_cert_or_pop_request ) :
15801587 from .broker import _acquire_token_silently
1588+ print ("dharshanb .broker import _acquire_token_silently line 1584" )
15811589 response = _acquire_token_silently (
15821590 "https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
15831591 self .client_id ,
@@ -1823,7 +1831,8 @@ def acquire_token_by_username_password(
18231831 """
18241832 claims = _merge_claims_challenge_and_capabilities (
18251833 self ._client_capabilities , claims_challenge )
1826- if self ._enable_broker :
1834+ # dharshanb
1835+ if self ._enable_broker and sys .platform != "linux" :
18271836 from .broker import _signin_silently
18281837 response = _signin_silently (
18291838 "https://{}/{}" .format (self .authority .instance , self .authority .tenant ),
@@ -2121,6 +2130,7 @@ def acquire_token_interactive(
21212130 and typically contains an "access_token" key.
21222131 - A dict containing an "error" key, when token refresh failed.
21232132 """
2133+ print ("dharshanb acquire_token_interactive application.py" )
21242134 data = kwargs .pop ("data" , {})
21252135 enable_msa_passthrough = kwargs .pop ( # MUST remove it from kwargs
21262136 "enable_msa_passthrough" , # Keep it as a hidden param, for now.
@@ -2134,6 +2144,11 @@ def acquire_token_interactive(
21342144 False
21352145 ) and data .get ("token_type" ) != "ssh-cert" # Work around a known issue as of PyMsalRuntime 0.8
21362146 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 ))
21372152 if not on_before_launching_ui :
21382153 on_before_launching_ui = lambda ** kwargs : None
21392154 if _is_running_in_cloud_shell () and prompt == "none" :
@@ -2142,7 +2157,10 @@ def acquire_token_interactive(
21422157 return self ._acquire_token_by_cloud_shell (scopes , data = data )
21432158 claims = _merge_claims_challenge_and_capabilities (
21442159 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)" )
21462164 if parent_window_handle is None :
21472165 raise ValueError (
21482166 "parent_window_handle is required when you opted into using broker. "
@@ -2167,8 +2185,11 @@ def acquire_token_interactive(
21672185 )
21682186 return self ._process_broker_response (response , scopes , data )
21692187
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 :
21712191 raise ValueError (self ._AUTH_SCHEME_UNSUPPORTED )
2192+
21722193 on_before_launching_ui (ui = "browser" )
21732194 telemetry_context = self ._build_telemetry_context (
21742195 self .ACQUIRE_TOKEN_INTERACTIVE )
0 commit comments