Skip to content

Commit d04793c

Browse files
committed
get-token-data
1 parent 4f49747 commit d04793c

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/azure-cli-core/azure/cli/core/auth/credential_adaptor.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ def _prepare_msal_kwargs(options=None):
5757
# Both get_token's kwargs and get_token_info's options are accepted as their schema is the same (at least for now).
5858
msal_kwargs = {}
5959
if options:
60-
# For VM SSH. 'data' support is a CLI-specific extension.
61-
# SDK doesn't support 'data': https://github.com/Azure/azure-sdk-for-python/pull/16397
62-
if 'data' in options:
63-
msal_kwargs['data'] = options['data']
6460
# For CAE
6561
if 'claims' in options:
6662
msal_kwargs['claims_challenge'] = options['claims']

src/azure-cli-core/azure/cli/core/auth/tests/test_credential_adaptor.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212

1313
MOCK_ACCESS_TOKEN = "mock_access_token"
14-
MOCK_DATA = {
15-
'key_id': 'test',
16-
'req_cnf': 'test',
17-
'token_type': 'ssh-cert'
18-
}
1914
MOCK_CLAIMS = {"test_claims": "value2"}
2015

2116
class MsalCredentialStub:
@@ -44,7 +39,7 @@ def _now_timestamp_mock():
4439

4540
class TestCredentialAdaptor(unittest.TestCase):
4641

47-
@mock.patch('azure.cli.core.auth.util._now_timestamp', new=_now_timestamp_mock)
42+
@mock.patch('azure.cli.core.auth.util.now_timestamp', new=_now_timestamp_mock)
4843
def test_get_token(self):
4944
msal_cred = MsalCredentialStub()
5045
sdk_cred = CredentialAdaptor(msal_cred)
@@ -56,15 +51,11 @@ def test_get_token(self):
5651
assert access_token.token == MOCK_ACCESS_TOKEN
5752
assert access_token.expires_on == 1630920323
5853

59-
# Note that SDK doesn't support 'data'. This is a CLI-specific extension.
60-
sdk_cred.get_token('https://management.core.windows.net//.default', data=MOCK_DATA)
61-
assert msal_cred.acquire_token_kwargs['data'] == MOCK_DATA
62-
6354
sdk_cred.get_token('https://management.core.windows.net//.default', claims=MOCK_CLAIMS)
6455
assert msal_cred.acquire_token_claims_challenge == MOCK_CLAIMS
6556

6657

67-
@mock.patch('azure.cli.core.auth.util._now_timestamp', new=_now_timestamp_mock)
58+
@mock.patch('azure.cli.core.auth.util.now_timestamp', new=_now_timestamp_mock)
6859
def test_get_token_info(self):
6960
msal_cred = MsalCredentialStub()
7061
sdk_cred = CredentialAdaptor(msal_cred)
@@ -78,10 +69,6 @@ def test_get_token_info(self):
7869

7970
assert msal_cred.acquire_token_scopes == ['https://management.core.windows.net//.default']
8071

81-
# Note that SDK doesn't support 'data'. If 'data' were supported, it should be tested with:
82-
sdk_cred.get_token_info('https://management.core.windows.net//.default', options={'data': MOCK_DATA})
83-
assert msal_cred.acquire_token_kwargs['data'] == MOCK_DATA
84-
8572
sdk_cred.get_token_info('https://management.core.windows.net//.default', options={'claims': MOCK_CLAIMS})
8673
assert msal_cred.acquire_token_claims_challenge == MOCK_CLAIMS
8774

0 commit comments

Comments
 (0)