Skip to content

Commit 5b171c8

Browse files
authored
Do not use deprecated TokenCache.find() (#36714)
azure-identity already requires msal>=1.29.0, so this should be safe. Fixes #36713
1 parent 95ecb64 commit 5b171c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ def _process_response(self, response: PipelineResponse, request_time: int) -> Ac
8282

8383
def get_cached_token(self, *scopes: str) -> Optional[AccessToken]:
8484
resource = _scopes_to_resource(*scopes)
85-
tokens = self._cache.find(TokenCache.CredentialType.ACCESS_TOKEN, target=[resource])
86-
for token in tokens:
85+
for token in self._cache.search(
86+
TokenCache.CredentialType.ACCESS_TOKEN,
87+
target=[resource],
88+
):
8789
expires_on = int(token["expires_on"])
8890
if expires_on > time.time():
8991
return AccessToken(token["secret"], expires_on)

0 commit comments

Comments
 (0)