-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EnvVar AZURE_AUTHORITY_HOST #10357
Changes from all commits
d6c7c01
6f93277
23842f8
64d1604
60a9f4d
c4ea285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
from azure.core.credentials import AccessToken | ||
from azure.core.exceptions import ClientAuthenticationError | ||
from .._constants import KnownAuthorities | ||
from . import get_default_authority | ||
|
||
try: | ||
ABC = abc.ABC | ||
|
@@ -34,7 +34,7 @@ class AadClientBase(ABC): | |
|
||
def __init__(self, tenant_id, client_id, cache=None, **kwargs): | ||
# type: (str, str, Optional[TokenCache], **Any) -> None | ||
authority = kwargs.pop("authority", KnownAuthorities.AZURE_PUBLIC_CLOUD) | ||
authority = kwargs.pop("authority", None) or get_default_authority() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not authority = kwargs.pop("authority", get_default_authority())? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, for two reasons:
|
||
if authority[-1] == "/": | ||
authority = authority[:-1] | ||
token_endpoint = "https://" + "/".join((authority, tenant_id, "oauth2/v2.0/token")) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
|
||
from .exception_wrapper import wrap_exceptions | ||
from .msal_transport_adapter import MsalTransportAdapter | ||
from .._constants import KnownAuthorities | ||
from .._internal import get_default_authority | ||
|
||
try: | ||
ABC = abc.ABC | ||
|
@@ -37,7 +37,7 @@ class MsalCredential(ABC): | |
def __init__(self, client_id, client_credential=None, **kwargs): | ||
# type: (str, Optional[Union[str, Mapping[str, str]]], **Any) -> None | ||
tenant_id = kwargs.pop("tenant_id", "organizations") | ||
authority = kwargs.pop("authority", KnownAuthorities.AZURE_PUBLIC_CLOUD) | ||
authority = kwargs.pop("authority", None) or get_default_authority() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
self._base_url = "https://" + "/".join((authority.strip("/"), tenant_id.strip("/"))) | ||
self._client_credential = client_credential | ||
self._client_id = client_id | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
from .. import CredentialUnavailableError | ||
from .._constants import KnownAuthorities | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's used to build the sets of authority aliases. |
||
from .._internal import get_default_authority | ||
|
||
try: | ||
ABC = abc.ABC | ||
|
@@ -86,7 +87,7 @@ class SharedTokenCacheBase(ABC): | |
def __init__(self, username=None, **kwargs): # pylint:disable=unused-argument | ||
# type: (Optional[str], **Any) -> None | ||
|
||
self._authority = kwargs.pop("authority", None) or KnownAuthorities.AZURE_PUBLIC_CLOUD | ||
self._authority = kwargs.pop("authority", None) or get_default_authority() | ||
self._authority_aliases = KNOWN_ALIASES.get(self._authority) or frozenset((self._authority,)) | ||
self._username = username | ||
self._tenant_id = kwargs.pop("tenant_id", None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not authority = kwargs.pop("authority", get_default_authority())?