Skip to content

Commit fa77a41

Browse files
authored
[Identity] Disable added CAE support for release (#29773)
Signed-off-by: Paul Van Eck <[email protected]>
1 parent 5ce892b commit fa77a41

File tree

5 files changed

+37
-39
lines changed

5 files changed

+37
-39
lines changed

sdk/identity/azure-identity/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.13.0 (2023-04-11)
3+
## 1.13.0 (Unreleased)
44

55
### Features Added
66

@@ -11,6 +11,7 @@
1111
> These changes do not impact the API of stable versions such as 1.12.0.
1212
> Only code written against a beta version such as 1.13.0b3 may be affected.
1313
- 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.
14+
- 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.
1415

1516
## 1.13.0b3 (2023-03-07)
1617

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import abc
66
import base64
77
import json
8-
import os
98
import time
109
from uuid import uuid4
1110
from typing import TYPE_CHECKING, List, Any, Iterable, Optional, Union, Dict
@@ -18,7 +17,6 @@
1817
from azure.core.pipeline.transport import HttpRequest
1918
from azure.core.credentials import AccessToken
2019
from azure.core.exceptions import ClientAuthenticationError
21-
from .._constants import EnvironmentVariables
2220
from .utils import get_default_authority, normalize_authority, resolve_tenant
2321
from .aadclient_certificate import AadClientCertificate
2422

@@ -54,8 +52,7 @@ def __init__(
5452

5553
self._cache = cache or TokenCache()
5654
self._client_id = client_id
57-
# CP1 = can handle claims challenges (CAE)
58-
self._capabilities = None if EnvironmentVariables.AZURE_IDENTITY_DISABLE_CP1 in os.environ else ["CP1"]
55+
self._capabilities = None
5956
self._additionally_allowed_tenants = additionally_allowed_tenants or []
6057
self._pipeline = self._build_pipeline(**kwargs)
6158

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

+26-26
Original file line numberDiff line numberDiff line change
@@ -328,39 +328,39 @@ def test_multitenant_cache():
328328
client_d.get_cached_access_token([scope], tenant_id=tenant_a)
329329

330330

331-
@pytest.mark.parametrize("method,args", BASE_CLASS_METHODS)
332-
def test_claims(method, args):
331+
# @pytest.mark.parametrize("method,args", BASE_CLASS_METHODS)
332+
# def test_claims(method, args):
333333

334-
scopes = ["scope"]
335-
claims = '{"access_token": {"essential": "true"}}'
334+
# scopes = ["scope"]
335+
# claims = '{"access_token": {"essential": "true"}}'
336336

337-
client = AadClient("tenant_id", "client_id")
337+
# client = AadClient("tenant_id", "client_id")
338338

339-
expected_merged_claims = '{"access_token": {"essential": "true", "xms_cc": {"values": ["CP1"]}}}'
339+
# expected_merged_claims = '{"access_token": {"essential": "true", "xms_cc": {"values": ["CP1"]}}}'
340340

341-
with patch.object(AadClient, "_post") as post_mock:
342-
func = getattr(client, method)
343-
func(scopes, *args, claims=claims)
341+
# with patch.object(AadClient, "_post") as post_mock:
342+
# func = getattr(client, method)
343+
# func(scopes, *args, claims=claims)
344344

345-
assert post_mock.call_count == 1
346-
data, _ = post_mock.call_args
347-
assert len(data) == 1
348-
assert data[0]["claims"] == expected_merged_claims
345+
# assert post_mock.call_count == 1
346+
# data, _ = post_mock.call_args
347+
# assert len(data) == 1
348+
# assert data[0]["claims"] == expected_merged_claims
349349

350350

351-
@pytest.mark.parametrize("method,args", BASE_CLASS_METHODS)
352-
def test_claims_disable_capabilities(method, args):
353-
scopes = ["scope"]
354-
claims = '{"access_token": {"essential": "true"}}'
351+
# @pytest.mark.parametrize("method,args", BASE_CLASS_METHODS)
352+
# def test_claims_disable_capabilities(method, args):
353+
# scopes = ["scope"]
354+
# claims = '{"access_token": {"essential": "true"}}'
355355

356-
with patch.dict("os.environ", {"AZURE_IDENTITY_DISABLE_CP1": "true"}):
357-
client = AadClient("tenant_id", "client_id")
356+
# with patch.dict("os.environ", {"AZURE_IDENTITY_DISABLE_CP1": "true"}):
357+
# client = AadClient("tenant_id", "client_id")
358358

359-
with patch.object(AadClient, "_post") as post_mock:
360-
func = getattr(client, method)
361-
func(scopes, *args, claims=claims)
359+
# with patch.object(AadClient, "_post") as post_mock:
360+
# func = getattr(client, method)
361+
# func(scopes, *args, claims=claims)
362362

363-
assert post_mock.call_count == 1
364-
data, _ = post_mock.call_args
365-
assert len(data) == 1
366-
assert data[0]["claims"] == claims
363+
# assert post_mock.call_count == 1
364+
# data, _ = post_mock.call_args
365+
# assert len(data) == 1
366+
# assert data[0]["claims"] == claims

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def test_certificate_credential(certificate_fixture, request):
4646
tenant_id, client_id, certificate_data=cert["cert_with_password_bytes"], password=cert["password"]
4747
)
4848
token = get_token(credential)
49-
parsed_payload = get_token_payload_contents(token.token)
50-
assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
49+
# parsed_payload = get_token_payload_contents(token.token)
50+
# assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
5151

5252

5353
def test_client_secret_credential(live_service_principal):
@@ -57,8 +57,8 @@ def test_client_secret_credential(live_service_principal):
5757
live_service_principal["client_secret"],
5858
)
5959
token = get_token(credential)
60-
parsed_payload = get_token_payload_contents(token.token)
61-
assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
60+
# parsed_payload = get_token_payload_contents(token.token)
61+
# assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
6262

6363

6464
def test_default_credential(live_service_principal):

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ async def test_certificate_credential(certificate_fixture, request):
4040
tenant_id, client_id, certificate_data=cert["cert_with_password_bytes"], password=cert["password"]
4141
)
4242
token = await get_token(credential)
43-
parsed_payload = get_token_payload_contents(token.token)
44-
assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
43+
# parsed_payload = get_token_payload_contents(token.token)
44+
# assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
4545

4646

4747

@@ -53,8 +53,8 @@ async def test_client_secret_credential(live_service_principal):
5353
live_service_principal["client_secret"],
5454
)
5555
token = await get_token(credential)
56-
parsed_payload = get_token_payload_contents(token.token)
57-
assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
56+
# parsed_payload = get_token_payload_contents(token.token)
57+
# assert "xms_cc" in parsed_payload and "CP1" in parsed_payload["xms_cc"]
5858

5959

6060

0 commit comments

Comments
 (0)