File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -552,6 +552,12 @@ def acquire_token_silent_with_error(
552552 return result
553553 final_result = result
554554 for alias in self ._get_authority_aliases (self .authority .instance ):
555+ if not self .token_cache .find (
556+ self .token_cache .CredentialType .REFRESH_TOKEN ,
557+ target = scopes ,
558+ query = {"environment" : alias }):
559+ # Skip heavy weight logic when RT for this alias doesn't exist
560+ continue
555561 the_authority = Authority (
556562 "https://" + alias + "/" + self .authority .tenant ,
557563 self .http_client ,
Original file line number Diff line number Diff line change @@ -590,6 +590,17 @@ def test_acquire_token_device_flow(self):
590590 config ["scope" ] = ["user.read" ]
591591 self ._test_device_flow (** config )
592592
593+ def test_acquire_token_silent_with_an_empty_cache_should_return_none (self ):
594+ config = self .get_lab_user (
595+ usertype = "cloud" , azureenvironment = self .environment , publicClient = "no" )
596+ app = msal .ConfidentialClientApplication (
597+ config ['client_id' ], authority = config ['authority' ],
598+ http_client = MinimalHttpClient ())
599+ result = app .acquire_token_silent (scopes = config ['scope' ], account = None )
600+ self .assertEqual (result , None )
601+ # Note: An alias in this region is no longer accepting HTTPS traffic.
602+ # If this test case passes without exception,
603+ # it means MSAL Python is not affected by that.
593604
594605if __name__ == "__main__" :
595606 unittest .main ()
You can’t perform that action at this time.
0 commit comments