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
Better support for B2C sovereign clouds
Based on the way we implemented it,
the previous implementation would still work, in a sense that the app
dev would be guided to bypass the Instance Discovery.
This commit merely adds a shortcut so that app dev would not have to
explicitly toggle validate_authority=False.
  • Loading branch information
rayluo committed Oct 15, 2019
commit d31d4722a50d771dd0533b37d0255ee281c98ffb
9 changes: 7 additions & 2 deletions msal/authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
'login.microsoftonline.us',
'login.microsoftonline.de',
])

WELL_KNOWN_B2C_HOSTS = [
"b2clogin.com",
"b2clogin.cn",
"b2clogin.us",
"b2clogin.de",
]

class Authority(object):
"""This class represents an (already-validated) authority.
Expand All @@ -43,7 +48,7 @@ def __init__(self, authority_url, validate_authority=True,
self.proxies = proxies
self.timeout = timeout
authority, self.instance, tenant = canonicalize(authority_url)
is_b2c = self.instance.endswith(".b2clogin.com")
is_b2c = any(self.instance.endswith("." + d) for d in WELL_KNOWN_B2C_HOSTS)
if (tenant != "adfs" and (not is_b2c) and validate_authority
and self.instance not in WELL_KNOWN_AUTHORITY_HOSTS):
payload = instance_discovery(
Expand Down