Skip to content

Commit ca8238b

Browse files
authored
[Identity] Rename arguments (Azure#30255)
Based on archboard discussion, `developer_credential_timeout` is renamed to `process_timeout` and `disable_authority_validation_and_instance_discovery` is renamed back to `disable_instance_discovery`. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
1 parent c11b2e2 commit ca8238b

File tree

11 files changed

+52
-29
lines changed

11 files changed

+52
-29
lines changed

sdk/identity/azure-identity/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
### Features Added
66

7-
- Changed parameter from `disable_instance_discovery` to `disable_authority_validation_and_instance_discovery` to make it more explicit.
8-
97
### Breaking Changes
108

119
> These changes do not impact the API of stable versions such as 1.12.0.
1210
> Only code written against a beta version such as 1.13.0b4 may be affected.
1311
- Windows Web Account Manager (WAM) Brokered Authentication is still in preview and not available in this release. It will be available in the next beta release.
1412
- Additional Continuous Access Evaluation (CAE) support for service principal credentials is still in preview and not available in this release. It will be available in the next beta release.
13+
- Renamed keyword argument `developer_credential_timeout` to `process_timeout` in `DefaultAzureCredential` to remain consistent with the other credentials that launch a subprocess to acquire tokens.
1514

1615

1716
### Bugs Fixed

sdk/identity/azure-identity/azure/identity/_credentials/browser.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ class InteractiveBrowserCredential(InteractiveCredential):
3939
will cache tokens in memory.
4040
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
4141
:keyword int timeout: seconds to wait for the user to complete authentication. Defaults to 300 (5 minutes).
42-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
43-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
44-
and authority validation.
42+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
43+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
44+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
45+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
46+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
47+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
48+
trustworthy.
4549
:raises ValueError: invalid **redirect_uri**
4650
4751
.. admonition:: Example:

sdk/identity/azure-identity/azure/identity/_credentials/certificate.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ class CertificateCredential(ClientCredentialBase):
4141
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
4242
will cache tokens in memory.
4343
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
44-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
45-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
46-
and authority validation.
44+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
45+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
46+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
47+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
48+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
49+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
50+
trustworthy.
4751
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
4852
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
4953
acquire tokens for any tenant the application can access.

sdk/identity/azure-identity/azure/identity/_credentials/client_secret.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ class ClientSecretCredential(ClientCredentialBase):
1919
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
2020
will cache tokens in memory.
2121
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
22-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
23-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
24-
and authority validation.
22+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
23+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
24+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
25+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
26+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
27+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
28+
trustworthy.
2529
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
2630
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
2731
acquire tokens for any tenant the application can access.

sdk/identity/azure-identity/azure/identity/_credentials/device_code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ class DeviceCodeCredential(InteractiveCredential):
4747
:keyword cache_persistence_options: configuration for persistent token caching. If unspecified, the credential
4848
will cache tokens in memory.
4949
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
50-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
51-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
52-
and authority validation.
50+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
51+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
52+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
53+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
54+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
55+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
56+
trustworthy.
5357
5458
.. admonition:: Example:
5559

sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ class OnBehalfOfCredential(MsalCredential, GetTokenMixin):
4444
is a unicode string, it will be encoded as UTF-8. If the certificate requires a different encoding, pass
4545
appropriately encoded bytes instead.
4646
:paramtype password: str or bytes
47-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
48-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
49-
and authority validation.
47+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
48+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
49+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
50+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
51+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
52+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
53+
trustworthy.
5054
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
5155
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
5256
acquire tokens for any tenant the application can access.

sdk/identity/azure-identity/azure/identity/_credentials/user_password.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ class UsernamePasswordCredential(InteractiveCredential):
3434
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
3535
will cache tokens in memory.
3636
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
37-
:keyword bool disable_authority_validation_and_instance_discovery: Determines whether or not instance discovery
38-
is performed when attempting to authenticate. Setting this to true will completely disable instance discovery
39-
and authority validation.
37+
:keyword bool disable_instance_discovery: Determines whether or not instance discovery is performed when attempting
38+
to authenticate. Setting this to true will completely disable both instance discovery and authority validation.
39+
This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in
40+
private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from
41+
https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the
42+
authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and
43+
trustworthy.
4044
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
4145
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
4246
acquire tokens for any tenant the application can access.

sdk/identity/azure-identity/azure/identity/_internal/msal_credentials.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def __init__(
2424
additionally_allowed_tenants: Optional[List[str]] = None,
2525
# allow_broker: Optional[bool] = None,
2626
authority: Optional[str] = None,
27-
disable_authority_validation_and_instance_discovery: Optional[bool] = None,
27+
disable_instance_discovery: Optional[bool] = None,
2828
tenant_id: Optional[str] = None,
2929
**kwargs
3030
) -> None:
31-
self._instance_discovery = None if disable_authority_validation_and_instance_discovery is None\
32-
else not disable_authority_validation_and_instance_discovery
31+
self._instance_discovery = None if disable_instance_discovery is None\
32+
else not disable_instance_discovery
3333
self._authority = normalize_authority(authority) if authority else get_default_authority()
3434
self._regional_authority = os.environ.get(EnvironmentVariables.AZURE_REGIONAL_AUTHORITY_NAME)
3535
if self._regional_authority and self._regional_authority.lower() in ["tryautodetect", "true"]:

sdk/identity/azure-identity/tests/test_device_code_credential.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_device_code_credential():
203203

204204
callback = Mock()
205205
credential = DeviceCodeCredential(
206-
client_id=client_id, prompt_callback=callback, transport=transport, disable_authority_validation_and_instance_discovery=True,
206+
client_id=client_id, prompt_callback=callback, transport=transport, disable_instance_discovery=True,
207207
)
208208

209209
now = datetime.datetime.utcnow()
@@ -259,7 +259,7 @@ def test_tenant_id():
259259

260260
callback = Mock()
261261
credential = DeviceCodeCredential(
262-
client_id=client_id, prompt_callback=callback, transport=transport, disable_authority_validation_and_instance_discovery=True, additionally_allowed_tenants=['*']
262+
client_id=client_id, prompt_callback=callback, transport=transport, disable_instance_discovery=True, additionally_allowed_tenants=['*']
263263
)
264264

265265
now = datetime.datetime.utcnow()
@@ -274,7 +274,7 @@ def test_timeout():
274274
msal_app.initiate_device_flow.return_value = flow
275275
msal_app.acquire_token_by_device_flow.return_value = {"error": "authorization_pending"}
276276

277-
credential = DeviceCodeCredential(client_id="_", timeout=1, disable_authority_validation_and_instance_discovery=True)
277+
credential = DeviceCodeCredential(client_id="_", timeout=1, disable_instance_discovery=True)
278278
with pytest.raises(ClientAuthenticationError) as ex:
279279
credential.get_token("scope")
280280
assert "timed out" in ex.value.message.lower()

sdk/identity/azure-identity/tests/test_instance_discovery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
def test_instance_discovery():
99
credential = MsalCredential(
1010
client_id="CLIENT_ID",
11-
disable_authority_validation_and_instance_discovery=True,
11+
disable_instance_discovery=True,
1212
)
1313
app = credential._get_app()
1414
assert not app._instance_discovery
1515

1616
credential = MsalCredential(
1717
client_id="CLIENT_ID",
18-
disable_authority_validation_and_instance_discovery=False,
18+
disable_instance_discovery=False,
1919
)
2020
app = credential._get_app()
2121
assert app._instance_discovery

0 commit comments

Comments
 (0)