Skip to content

Commit 9ea120e

Browse files
xiangyan99pvaneck
andauthored
rename use_operating_system_account to use_default_broker_account (#34833)
* rename use_operating_system_account to use_default_broker_account * Update sdk/identity/azure-identity-broker/README.md Co-authored-by: Paul Van Eck <[email protected]> --------- Co-authored-by: Paul Van Eck <[email protected]>
1 parent 9cf64ed commit 9ea120e

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

sdk/identity/azure-identity-broker/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Features Added
66

7-
- `InteractiveBrowserBrokerCredential` now supports a `use_operating_system_account` property to enable the use of the currently logged in operating system account for authentication rather than prompting for a credential.
7+
- `InteractiveBrowserBrokerCredential` now supports a `use_default_broker_account` property to enable the use of the currently logged in operating system account for authentication rather than prompting for a credential.
88
- Added `enable_support_logging` as a keyword argument to `InteractiveBrowserBrokerCredential`. This allows additional support logging which may contain PII.
99

1010
### Breaking Changes

sdk/identity/azure-identity-broker/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ Microsoft Entra applications rely on redirect URIs to determine where to send th
3838
ms-appx-web://Microsoft.AAD.BrokerPlugin/{client_id}
3939
```
4040

41+
## Use the default account for sign-in
42+
43+
When the `use_default_broker_account` argument is set to `True`, the credential will attempt to silently use the default broker account. If using the default account fails, the credential will fall back to interactive authentication.
44+
45+
```
46+
cred = new InteractiveBrowserBrokerCredential(use_default_broker_account=True)
47+
```
48+
4149
## Examples
4250

4351
### Authenticate with `InteractiveBrowserBrokerCredential`

sdk/identity/azure-identity-broker/azure/identity/broker/_browser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class InteractiveBrowserBrokerCredential(_InteractiveBrowserCredential):
3737
:keyword int timeout: seconds to wait for the user to complete authentication. Defaults to 300 (5 minutes).
3838
:keyword int parent_window_handle: If your app is a GUI app running on a modern Windows system, you are required to
3939
also provide its window handle so that the sign in UI window will properly pop up on top of your window.
40-
:keyword bool use_operating_system_account: Whether to authenticate with the currently signed in user instead of
40+
:keyword bool use_default_broker_account: Whether to authenticate with the currently signed in user instead of
4141
prompting the user with a login dialog. Defaults to False.
4242
:keyword bool enable_msa_passthrough: Determines whether Microsoft Account (MSA) passthrough is enabled. Note, this
4343
is only needed for select legacy first-party applications. Defaults to False.
@@ -57,7 +57,7 @@ class InteractiveBrowserBrokerCredential(_InteractiveBrowserCredential):
5757
def __init__(self, **kwargs: Any) -> None:
5858
self._parent_window_handle = kwargs.pop("parent_window_handle", None)
5959
self._enable_msa_passthrough = kwargs.pop("enable_msa_passthrough", False)
60-
self._use_operating_system_account = kwargs.pop("use_operating_system_account", False)
60+
self._use_default_broker_account = kwargs.pop("use_default_broker_account", False)
6161
super().__init__(**kwargs)
6262

6363
@wrap_exceptions
@@ -67,7 +67,7 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> Dict:
6767
app = self._get_app(**kwargs)
6868
port = self._parsed_url.port if self._parsed_url else None
6969

70-
if self._use_operating_system_account:
70+
if self._use_default_broker_account:
7171
try:
7272
result = app.acquire_token_interactive(
7373
scopes=scopes,

sdk/identity/azure-identity-broker/tests/test_broker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_interactive_browser_broker_cred_signed_in_account():
2121
with patch("msal.broker._signin_silently", Mock(return_value="token")) as mock_signin_silently:
2222
try:
2323
cred = InteractiveBrowserBrokerCredential(
24-
parent_window_handle="window_handle", use_operating_system_account=True
24+
parent_window_handle="window_handle", use_default_broker_account=True
2525
)
2626
cred.get_token("scope")
2727
except Exception: # msal raises TypeError which is expected. We are not testing msal here.

0 commit comments

Comments
 (0)