Skip to content

Commit

Permalink
ADFS and B2C shall not invoke broker
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Sep 4, 2024
1 parent fd0335f commit 4ce6646
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions msal/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ class ClientApplication(object):
"You can enable broker by following these instructions. "
"https://msal-python.readthedocs.io/en/latest/#publicclientapplication")

_enable_broker = False

def __init__(
self, client_id,
client_credential=None, authority=None, validate_authority=True,
Expand Down Expand Up @@ -651,14 +649,22 @@ def _decide_broker(self, allow_broker, enable_pii_log):
"enable_broker_on_windows=True, "
"enable_broker_on_mac=...)",
DeprecationWarning)
self._enable_broker = self._enable_broker or (
opted_in_for_broker = (
self._enable_broker # True means Opted-in from PCA
or (
# When we started the broker project on Windows platform,
# the allow_broker was meant to be cross-platform. Now we realize
# that other platforms have different redirect_uri requirements,
# so the old allow_broker is deprecated and will only for Windows.
allow_broker and sys.platform == "win32")
if (self._enable_broker and not is_confidential_app
and not self.authority.is_adfs and not self.authority._is_b2c):
)
self._enable_broker = ( # This same variable will also store the state
opted_in_for_broker
and not is_confidential_app
and not self.authority.is_adfs
and not self.authority._is_b2c
)
if self._enable_broker:
try:
_init_broker(enable_pii_log)
except RuntimeError:
Expand Down

0 comments on commit 4ce6646

Please sign in to comment.