Skip to content

Commit

Permalink
[Core] aaz: Fix AAZBearerTokenCredentialPolicy to support MSIAuthen…
Browse files Browse the repository at this point in the history
…ticationWrapper crendital (#23471)
  • Loading branch information
kairu-ms authored Aug 11, 2022
1 parent 0625878 commit 4826c98
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/azure-cli-core/azure/cli/core/aaz/_http_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def _need_new_token(self):

@property
def _need_new_aux_tokens(self):
if not hasattr(self._credential, 'get_auxiliary_tokens'):
return False
if not self._aux_tokens:
return True
for token in self._aux_tokens:
Expand Down Expand Up @@ -91,8 +93,11 @@ def authorize_request(self, request, *scopes, **kwargs):
:param ~azure.core.pipeline.PipelineRequest request: the request
:param str scopes: required scopes of authentication
"""
self._token = self._credential.get_token(*scopes, **kwargs)
self._aux_tokens = self._credential.get_auxiliary_tokens(*self._scopes)
if self._need_new_token:
self._token = self._credential.get_token(*scopes, **kwargs)

if self._need_new_aux_tokens:
self._aux_tokens = self._credential.get_auxiliary_tokens(*self._scopes)

self._update_headers(request.http_request.headers)

Expand Down

0 comments on commit 4826c98

Please sign in to comment.