|
28 | 28 | from ._constants import get_managed_sku |
29 | 29 | from ._constants import ACR_AUDIENCE_RESOURCE_NAME |
30 | 30 | from ._utils import get_registry_by_name, ResourceNotFound |
31 | | -from .policy import acr_config_authentication_as_arm_show |
32 | 31 | from ._format import add_timestamp |
33 | 32 | from ._errors import CONNECTIVITY_TOOMANYREQUESTS_ERROR |
34 | 33 |
|
@@ -135,18 +134,14 @@ def _get_aad_token_after_challenge(cli_ctx, |
135 | 134 | artifact_repository, |
136 | 135 | permission, |
137 | 136 | is_diagnostics_context, |
138 | | - use_acr_audience, |
139 | 137 | verify_user_permissions): |
140 | 138 | authurl = urlparse(token_params['realm']) |
141 | 139 | authhost = urlunparse((authurl[0], authurl[1], '/oauth2/exchange', '', '', '')) |
142 | 140 |
|
143 | 141 | from azure.cli.core._profile import Profile |
144 | 142 | profile = Profile(cli_ctx=cli_ctx) |
145 | 143 |
|
146 | | - scope = None |
147 | | - if use_acr_audience: |
148 | | - logger.debug("Using ACR audience token for authentication") |
149 | | - scope = "https://{}.azure.net".format(ACR_AUDIENCE_RESOURCE_NAME) |
| 144 | + scope = "https://{}.azure.net".format(ACR_AUDIENCE_RESOURCE_NAME) |
150 | 145 |
|
151 | 146 | # this might be a cross tenant scenario, so pass subscription to get_raw_token |
152 | 147 | creds, _, tenant = profile.get_raw_token(subscription=get_subscription_id(cli_ctx), |
@@ -267,7 +262,6 @@ def _get_aad_token(cli_ctx, |
267 | 262 | artifact_repository=None, |
268 | 263 | permission=None, |
269 | 264 | is_diagnostics_context=False, |
270 | | - use_acr_audience=False, |
271 | 265 | verify_user_permissions=False): |
272 | 266 | """Obtains refresh and access tokens for an AAD-enabled registry. Will return the allowed actions if |
273 | 267 | verify_user_permissions is set to True. |
@@ -296,7 +290,6 @@ def _get_aad_token(cli_ctx, |
296 | 290 | artifact_repository, |
297 | 291 | permission, |
298 | 292 | is_diagnostics_context, |
299 | | - use_acr_audience, |
300 | 293 | verify_user_permissions) |
301 | 294 |
|
302 | 295 |
|
@@ -453,19 +446,12 @@ def _get_credentials(cmd, # pylint: disable=too-many-statements |
453 | 446 | if not registry or registry.sku.name in get_managed_sku(cmd): |
454 | 447 | logger.info("Attempting to retrieve AAD refresh token...") |
455 | 448 | try: |
456 | | - use_acr_audience = False |
457 | | - |
458 | | - if registry: |
459 | | - aad_auth_policy = acr_config_authentication_as_arm_show(cmd, registry_name, resource_group_name) |
460 | | - use_acr_audience = (aad_auth_policy and aad_auth_policy.status == 'disabled') |
461 | | - |
462 | 449 | return login_server, EMPTY_GUID, _get_aad_token(cli_ctx, |
463 | 450 | login_server, |
464 | 451 | only_refresh_token, |
465 | 452 | repository, |
466 | 453 | artifact_repository, |
467 | | - permission, |
468 | | - use_acr_audience=use_acr_audience) |
| 454 | + permission) |
469 | 455 | except CLIError as e: |
470 | 456 | raise_toomanyrequests_error(str(e)) |
471 | 457 | logger.warning("%s: %s", AAD_TOKEN_BASE_ERROR_MESSAGE, str(e)) |
|
0 commit comments