Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Further refactoring
  • Loading branch information
rayluo committed Oct 24, 2019
commit 1d8035b649351c6bb72d05a447396818cde0caa7
8 changes: 5 additions & 3 deletions msal/authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ def __init__(self, authority_url, validate_authority=True,
self.proxies = proxies
self.timeout = timeout
authority, self.instance, tenant = canonicalize(authority_url)
parts = authority.path.split('/')
is_b2c = True if any(self.instance.endswith("." + d) for d in WELL_KNOWN_B2C_HOSTS) or \
(len(parts) == 3 and parts[2].lower().startswith("b2c_")) else False
if any(self.instance.endswith("." + d) for d in WELL_KNOWN_B2C_HOSTS):
is_b2c = True
else: # Less reliable approach
parts = authority.path.split('/')
is_b2c = len(parts) == 3 and parts[2].lower().startswith("b2c_")
if (tenant != "adfs" and (not is_b2c) and validate_authority
and self.instance not in WELL_KNOWN_AUTHORITY_HOSTS):
payload = instance_discovery(
Expand Down