in azure/Kqlmagic/my_aad_helper.py [0:0]
def _get_authentication_error_kwargs(self):
" collect info for AuthenticationError exception and raise it"
kwargs = {}
if self._current_authentication_method is AuthenticationMethod.aad_username_password:
kwargs = {"username": self._username, "client_id": self._client_id}
elif self._current_authentication_method is AuthenticationMethod.aad_application_key:
kwargs = {"client_id": self._client_id}
elif self._current_authentication_method is AuthenticationMethod.aad_code_login:
kwargs = {"client_id": self._client_id}
elif self._current_authentication_method is AuthenticationMethod.aad_application_certificate:
kwargs = {"client_id": self._client_id, "thumbprint": self._thumbprint}
elif self._current_authentication_method is AuthenticationMethod.managed_service_identity:
kwargs = self._options.get("try_msi")
elif self._current_authentication_method is AuthenticationMethod.azcli_login:
pass
elif self._current_authentication_method is AuthenticationMethod.azcli_login_by_profile:
pass
elif self._current_authentication_method is AuthenticationMethod.azcli_login_subscription:
kwargs = {"subscription": self._options.get("try_azcli_login_subscription")}
elif self._current_authentication_method is AuthenticationMethod.aux_token:
token_dict = {}
for key in self._options.get("try_token"):
if key in [TokenResponseFields.ACCESS_TOKEN, OAuth2TokenFields.ACCESS_TOKEN, TokenResponseFields.REFRESH_TOKEN, OAuth2TokenFields.REFRESH_TOKEN, OAuth2TokenFields.ID_TOKEN]:
token_dict[key] = f"..."
else:
token_dict[key] = self._options.get("try_token")[key]
kwargs = token_dict
else:
pass
authority = None
if self._current_adal_context is not None:
authority = self._current_adal_context.authority.url
elif self._current_authentication_method == self._authentication_method:
authority = self._authority_uri
elif self._current_token is not None:
authority = self._get_authority_from_token(self._current_token)
else:
authority = authority or self._current_authentication_method
if authority is None:
if self._current_authentication_method in [AuthenticationMethod.managed_service_identity, AuthenticationMethod.azcli_login_subscription, AuthenticationMethod.aux_token]:
authority = self._current_authentication_method
else:
authority = self._authority_uri
kwargs["authority"] = authority
kwargs["authentication_method"] = self._current_authentication_method
kwargs["resource"] = self._resource
return kwargs