Skip to content
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

Merged
merged 6 commits into from
Apr 6, 2020
Merged

Add EnvVar AZURE_AUTHORITY_HOST #10357

merged 6 commits into from
Apr 6, 2020

Conversation

v-xuto
Copy link
Member

@v-xuto v-xuto commented Mar 18, 2020

Added EnvVar AZURE_AUTHORITY_HOST to azure.identity._constants.
TokenCredentialOptions has an AuthorityHost property.
This will be modified to support EnvVar override with AZURE_AUTHORITY_HOST.
Azure/azure-sdk-for-java/issues/5967

@v-xuto v-xuto requested review from chlowell and schaabs as code owners March 18, 2020 08:02
@adxsdk6
Copy link

adxsdk6 commented Mar 18, 2020

Can one of the admins verify this patch?

@tzhanl tzhanl requested a review from jongio March 18, 2020 08:33
schaabs
schaabs previously approved these changes Mar 25, 2020
@jongio
Copy link
Member

jongio commented Mar 27, 2020

Can you please add tests?

@v-xuto v-xuto dismissed stale reviews from schaabs and chlowell March 31, 2020 01:41

The base branch was changed.

@v-xuto v-xuto changed the base branch from Identity-ENVVARs to master March 31, 2020 01:41
Copy link
Member

@chlowell chlowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jon, this deserves test coverage. Please also format with black -l 120.

jongio
jongio previously approved these changes Apr 6, 2020
@chlowell chlowell requested a review from xiangyan99 April 6, 2020 19:47
@@ -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()
Copy link
Member

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())?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for two reasons:

  1. to make authority=None get the default value
  2. to prevent invoking get_default_authority when a value was passed

@@ -10,6 +10,7 @@

from .. import CredentialUnavailableError
from .._constants import KnownAuthorities
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's used to build the sets of authority aliases.

@@ -61,7 +62,7 @@ class DefaultAzureCredential(ChainedTokenCredential):
"""

def __init__(self, **kwargs):
authority = kwargs.pop("authority", None) or KnownAuthorities.AZURE_PUBLIC_CLOUD
authority = kwargs.pop("authority", None) or get_default_authority()
Copy link
Member

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())?

@@ -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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@chlowell chlowell merged commit 19ae038 into Azure:master Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants