From 88b3dc9a70de4b066066cecd4b8ff08c606176f6 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Thu, 15 Oct 2020 17:16:48 +0800 Subject: [PATCH 1/8] Bump azure-mgmt-resource to 15.0.0 --- src/azure-cli-core/setup.py | 2 +- src/azure-cli/requirements.py3.Darwin.txt | 2 +- src/azure-cli/requirements.py3.Linux.txt | 2 +- src/azure-cli/requirements.py3.windows.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index f98cfb5c856..61bb92ed44e 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -60,7 +60,7 @@ 'requests~=2.22', 'six~=1.12', 'pkginfo>=1.5.0.1', - 'azure-mgmt-resource==10.2.0', + 'azure-mgmt-resource==15.0.0', 'azure-mgmt-core==1.2.0' ] diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 728e5fc7092..df4c5dc9ecf 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -68,7 +68,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.2.0 +azure-mgmt-resource==15.0.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index 728e5fc7092..df4c5dc9ecf 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -68,7 +68,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.2.0 +azure-mgmt-resource==15.0.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 0839db77093..cf800abb43f 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -68,7 +68,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.2.0 +azure-mgmt-resource==15.0.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0 From 71857115c9aa36681285a93b424cd3ed9867bfc4 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Mon, 26 Oct 2020 14:54:36 +0800 Subject: [PATCH 2/8] user login --- src/azure-cli-core/azure/cli/core/_profile.py | 22 +++++++++---------- .../azure/cli/core/adal_authentication.py | 9 ++++++++ .../azure/cli/core/commands/client_factory.py | 8 +++++-- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index ca1281fbd72..6efb65caaa4 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -259,7 +259,7 @@ def _normalize_properties(self, user, subscriptions, is_service_principal, cert_ subscription_dict = { _SUBSCRIPTION_ID: s.id.rpartition('/')[2], _SUBSCRIPTION_NAME: display_name, - _STATE: s.state.value, + _STATE: s.state, _USER_ENTITY: { _USER_NAME: user, _USER_TYPE: _SERVICE_PRINCIPAL if is_service_principal else _USER @@ -804,12 +804,12 @@ def create_arm_client_factory(credentials): return arm_client_factory(credentials) from azure.cli.core.profiles._shared import get_client_class from azure.cli.core.profiles import ResourceType, get_api_version - from azure.cli.core.commands.client_factory import configure_common_settings + from azure.cli.core.commands.client_factory import _prepare_client_kwargs client_type = get_client_class(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS) api_version = get_api_version(cli_ctx, ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS) + client_kwargs = _prepare_client_kwargs(cli_ctx) client = client_type(credentials, api_version=api_version, - base_url=self.cli_ctx.cloud.endpoints.resource_manager) - configure_common_settings(cli_ctx, client) + base_url=self.cli_ctx.cloud.endpoints.resource_manager, **client_kwargs) return client self._arm_client_factory = create_arm_client_factory @@ -827,9 +827,9 @@ def find_from_user_account(self, username, password, tenant, resource): self.user_id = token_entry[_TOKEN_ENTRY_USER_ID] if tenant is None: - result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource) + result = self._find_using_common_tenant(token_entry, resource) else: - result = self._find_using_specific_tenant(tenant, token_entry[_ACCESS_TOKEN]) + result = self._find_using_specific_tenant(tenant, token_entry) return result def find_through_authorization_code_flow(self, tenant, resource, authority_url): @@ -884,12 +884,12 @@ def _create_auth_context(self, tenant, use_token_cache=True): def _find_using_common_tenant(self, access_token, resource): import adal - from msrest.authentication import BasicTokenAuthentication + from azure.cli.core.adal_authentication import BasicTokenCredential all_subscriptions = [] empty_tenants = [] mfa_tenants = [] - token_credential = BasicTokenAuthentication({'access_token': access_token}) + token_credential = BasicTokenCredential(access_token) client = self._arm_client_factory(token_credential) tenants = client.tenants.list() for t in tenants: @@ -916,7 +916,7 @@ def _find_using_common_tenant(self, access_token, resource): continue subscriptions = self._find_using_specific_tenant( tenant_id, - temp_credentials[_ACCESS_TOKEN]) + temp_credentials) if not subscriptions: empty_tenants.append(t) @@ -958,9 +958,9 @@ def _find_using_common_tenant(self, access_token, resource): return all_subscriptions def _find_using_specific_tenant(self, tenant, access_token): - from msrest.authentication import BasicTokenAuthentication + from azure.cli.core.adal_authentication import BasicTokenCredential - token_credential = BasicTokenAuthentication({'access_token': access_token}) + token_credential = BasicTokenCredential(access_token) client = self._arm_client_factory(token_credential) subscriptions = client.subscriptions.list() all_subscriptions = [] diff --git a/src/azure-cli-core/azure/cli/core/adal_authentication.py b/src/azure-cli-core/azure/cli/core/adal_authentication.py index 68ba4b08b0d..a41c80ffa5d 100644 --- a/src/azure-cli-core/azure/cli/core/adal_authentication.py +++ b/src/azure-cli-core/azure/cli/core/adal_authentication.py @@ -93,3 +93,12 @@ class MSIAuthenticationWrapper(MSIAuthentication): def get_token(self, *scopes, **kwargs): # pylint:disable=unused-argument self.set_token() return AccessToken(self.token['access_token'], int(self.token['expires_on'])) + + +class BasicTokenCredential: + """A Track 2 implementation of msrest.authentication.BasicTokenAuthentication.""" + def __init__(self, token_entry): + self.token_entry = token_entry + + def get_token(self, *scopes, **kwargs): + return AccessToken(self.token_entry['accessToken'], int(self.token_entry['expiresIn'] + time.time())) diff --git a/src/azure-cli-core/azure/cli/core/commands/client_factory.py b/src/azure-cli-core/azure/cli/core/commands/client_factory.py index 8a9472469f8..4668ca03ea6 100644 --- a/src/azure-cli-core/azure/cli/core/commands/client_factory.py +++ b/src/azure-cli-core/azure/cli/core/commands/client_factory.py @@ -110,12 +110,16 @@ def configure_common_settings(cli_ctx, client): client.config.generate_client_request_id = 'x-ms-client-request-id' not in cli_ctx.data['headers'] -def configure_common_settings_track2(cli_ctx): +def _prepare_client_kwargs(cli_ctx): + """Prepare kwargs for Track 2 SDK client.""" client_kwargs = {} client_kwargs.update(_debug.change_ssl_cert_verification_track2()) + # This enables NetworkTraceLoggingPolicy which logs all headers without being redacted except Authorization client_kwargs['logging_enable'] = True + # TODO: Need a way to disable ARMHttpLoggingPolicy + # client_kwargs['http_logging_policy'] = None client_kwargs['user_agent'] = get_az_user_agent() try: @@ -168,7 +172,7 @@ def _get_mgmt_service_client(cli_ctx, client_kwargs.update(kwargs) if is_track2(client_type): - client_kwargs.update(configure_common_settings_track2(cli_ctx)) + client_kwargs.update(_prepare_client_kwargs(cli_ctx)) if subscription_bound: client = client_type(cred, subscription_id, **client_kwargs) From 25a702dd63658201f23492a3cac52b8d85171047 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Mon, 26 Oct 2020 15:06:57 +0800 Subject: [PATCH 3/8] Pass ADAL token entry --- src/azure-cli-core/azure/cli/core/_profile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index 6efb65caaa4..b001329cf5b 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -615,7 +615,7 @@ def get_refresh_token(self, resource=None, if user_type == _USER: _, _, token_entry = self._creds_cache.retrieve_token_for_user( username_or_sp_id, account[_TENANT_ID], resource) - return None, token_entry.get(_REFRESH_TOKEN), token_entry[_ACCESS_TOKEN], str(account[_TENANT_ID]) + return None, token_entry.get(_REFRESH_TOKEN), token_entry, str(account[_TENANT_ID]) sp_secret = self._creds_cache.retrieve_secret_of_service_principal(username_or_sp_id) return username_or_sp_id, sp_secret, None, str(account[_TENANT_ID]) @@ -846,9 +846,9 @@ def find_through_authorization_code_flow(self, tenant, resource, authority_url): self.user_id = token_entry[_TOKEN_ENTRY_USER_ID] logger.warning("You have logged in. Now let us find all the subscriptions to which you have access...") if tenant is None: - result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource) + result = self._find_using_common_tenant(token_entry, resource) else: - result = self._find_using_specific_tenant(tenant, token_entry[_ACCESS_TOKEN]) + result = self._find_using_specific_tenant(tenant, token_entry) return result def find_through_interactive_flow(self, tenant, resource): @@ -858,16 +858,16 @@ def find_through_interactive_flow(self, tenant, resource): token_entry = context.acquire_token_with_device_code(resource, code, _CLIENT_ID) self.user_id = token_entry[_TOKEN_ENTRY_USER_ID] if tenant is None: - result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource) + result = self._find_using_common_tenant(token_entry, resource) else: - result = self._find_using_specific_tenant(tenant, token_entry[_ACCESS_TOKEN]) + result = self._find_using_specific_tenant(tenant, token_entry) return result def find_from_service_principal_id(self, client_id, sp_auth, tenant, resource): context = self._create_auth_context(tenant, False) token_entry = sp_auth.acquire_token(context, resource, client_id) self.user_id = client_id - result = self._find_using_specific_tenant(tenant, token_entry[_ACCESS_TOKEN]) + result = self._find_using_specific_tenant(tenant, token_entry) self.tenants = [tenant] return result @@ -1023,7 +1023,7 @@ def retrieve_token_for_user(self, username, tenant, resource): if self.adal_token_cache.has_state_changed: self.persist_cached_creds() - return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry[_ACCESS_TOKEN], token_entry) + return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry, token_entry) def retrieve_msal_token(self, tenant, scopes, data, refresh_token): """ @@ -1059,7 +1059,7 @@ def retrieve_token_for_service_principal(self, sp_id, resource, tenant, use_cert cred.get(_SERVICE_PRINCIPAL_CERT_FILE, None), use_cert_sn_issuer) token_entry = sp_auth.acquire_token(context, resource, sp_id) - return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry[_ACCESS_TOKEN], token_entry) + return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry, token_entry) def retrieve_secret_of_service_principal(self, sp_id): self.load_adal_token_cache() From 834c905d1f72284f9c9fdcd8a8c84b4da8454b78 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Mon, 26 Oct 2020 15:30:36 +0800 Subject: [PATCH 4/8] Roll back token entry --- src/azure-cli-core/azure/cli/core/_profile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index b001329cf5b..99a3d47c10d 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -615,7 +615,7 @@ def get_refresh_token(self, resource=None, if user_type == _USER: _, _, token_entry = self._creds_cache.retrieve_token_for_user( username_or_sp_id, account[_TENANT_ID], resource) - return None, token_entry.get(_REFRESH_TOKEN), token_entry, str(account[_TENANT_ID]) + return None, token_entry.get(_REFRESH_TOKEN), token_entry[_ACCESS_TOKEN], str(account[_TENANT_ID]) sp_secret = self._creds_cache.retrieve_secret_of_service_principal(username_or_sp_id) return username_or_sp_id, sp_secret, None, str(account[_TENANT_ID]) @@ -1023,7 +1023,7 @@ def retrieve_token_for_user(self, username, tenant, resource): if self.adal_token_cache.has_state_changed: self.persist_cached_creds() - return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry, token_entry) + return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry[_ACCESS_TOKEN], token_entry) def retrieve_msal_token(self, tenant, scopes, data, refresh_token): """ @@ -1059,7 +1059,7 @@ def retrieve_token_for_service_principal(self, sp_id, resource, tenant, use_cert cred.get(_SERVICE_PRINCIPAL_CERT_FILE, None), use_cert_sn_issuer) token_entry = sp_auth.acquire_token(context, resource, sp_id) - return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry, token_entry) + return (token_entry[_TOKEN_ENTRY_TOKEN_TYPE], token_entry[_ACCESS_TOKEN], token_entry) def retrieve_secret_of_service_principal(self, sp_id): self.load_adal_token_cache() From 0eb0ece9524cd6d39781c5adce4b179158019027 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Mon, 26 Oct 2020 15:30:43 +0800 Subject: [PATCH 5/8] Fix tests --- src/azure-cli-core/azure/cli/core/tests/test_profile.py | 2 +- .../azure/cli/core/tests/test_profile_v2016_06_01.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/tests/test_profile.py b/src/azure-cli-core/azure/cli/core/tests/test_profile.py index 7022fca706d..726ae00e978 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_profile.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_profile.py @@ -314,7 +314,7 @@ def test_subscription_finder_constructor(self, get_api_mock): cli.cloud.endpoints.resource_manager = 'http://foo_arm' finder = SubscriptionFinder(cli, None, None, arm_client_factory=None) result = finder._arm_client_factory(mock.MagicMock()) - self.assertEqual(result.config.base_url, 'http://foo_arm') + self.assertEqual(result._client._base_url, 'http://foo_arm') @mock.patch('adal.AuthenticationContext', autospec=True) def test_get_auth_info_for_logged_in_service_principal(self, mock_auth_context): diff --git a/src/azure-cli-core/azure/cli/core/tests/test_profile_v2016_06_01.py b/src/azure-cli-core/azure/cli/core/tests/test_profile_v2016_06_01.py index d4cf59042cd..062d1ec098d 100644 --- a/src/azure-cli-core/azure/cli/core/tests/test_profile_v2016_06_01.py +++ b/src/azure-cli-core/azure/cli/core/tests/test_profile_v2016_06_01.py @@ -294,7 +294,7 @@ def test_subscription_finder_constructor(self, get_api_mock): cli.cloud.endpoints.resource_manager = 'http://foo_arm' finder = SubscriptionFinder(cli, None, None, arm_client_factory=None) result = finder._arm_client_factory(mock.MagicMock()) - self.assertEqual(result.config.base_url, 'http://foo_arm') + self.assertEqual(result._client._base_url, 'http://foo_arm') @mock.patch('adal.AuthenticationContext', autospec=True) def test_get_auth_info_for_logged_in_service_principal(self, mock_auth_context): From 81fcc34349b9c8fa6cfa9a80c8fd3d869114a331 Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Tue, 27 Oct 2020 10:07:44 +0800 Subject: [PATCH 6/8] Disable ARMHttpLoggingPolicy --- .../azure/cli/core/commands/client_factory.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/commands/client_factory.py b/src/azure-cli-core/azure/cli/core/commands/client_factory.py index 4668ca03ea6..3618f9ac531 100644 --- a/src/azure-cli-core/azure/cli/core/commands/client_factory.py +++ b/src/azure-cli-core/azure/cli/core/commands/client_factory.py @@ -114,12 +114,16 @@ def _prepare_client_kwargs(cli_ctx): """Prepare kwargs for Track 2 SDK client.""" client_kwargs = {} + # Change SSL verification behavior client_kwargs.update(_debug.change_ssl_cert_verification_track2()) - # This enables NetworkTraceLoggingPolicy which logs all headers without being redacted except Authorization + # Enable NetworkTraceLoggingPolicy which logs all headers (except Authorization) without being redacted client_kwargs['logging_enable'] = True - # TODO: Need a way to disable ARMHttpLoggingPolicy - # client_kwargs['http_logging_policy'] = None + + # Disable ARMHttpLoggingPolicy which logs only allowed headers + from azure.core.pipeline.policies import SansIOHTTPPolicy + client_kwargs['http_logging_policy'] = SansIOHTTPPolicy() + client_kwargs['user_agent'] = get_az_user_agent() try: From 557fc996f8b653c8f3933c9cb2cad08a51a836fe Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Tue, 27 Oct 2020 10:33:10 +0800 Subject: [PATCH 7/8] Refactor --- src/azure-cli-core/azure/cli/core/_profile.py | 8 ++++++-- .../azure/cli/core/commands/client_factory.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index b5eed234dfe..fef62704545 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -815,10 +815,12 @@ def create_arm_client_factory(credentials): return arm_client_factory(credentials) from azure.cli.core.profiles._shared import get_client_class from azure.cli.core.profiles import ResourceType, get_api_version - from azure.cli.core.commands.client_factory import _prepare_client_kwargs + from azure.cli.core.commands.client_factory import _prepare_client_kwargs_track2 client_type = get_client_class(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS) api_version = get_api_version(cli_ctx, ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS) - client_kwargs = _prepare_client_kwargs(cli_ctx) + + client_kwargs = _prepare_client_kwargs_track2(cli_ctx) + # We don't need to change credential_scopes as 'scopes' is ignored by BasicTokenCredential anyway client = client_type(credentials, api_version=api_version, base_url=self.cli_ctx.cloud.endpoints.resource_manager, **client_kwargs) return client @@ -905,6 +907,7 @@ def _find_using_common_tenant(self, access_token, resource): tenants = client.tenants.list() for t in tenants: tenant_id = t.tenant_id + logger.debug("Finding subscriptions under tenant %s", tenant_id) # display_name is available since /tenants?api-version=2018-06-01, # not available in /tenants?api-version=2016-06-01 if not hasattr(t, 'display_name'): @@ -913,6 +916,7 @@ def _find_using_common_tenant(self, access_token, resource): t.display_name = t.additional_properties.get('displayName') temp_context = self._create_auth_context(tenant_id) try: + logger.debug("Acquiring a token with tenant=%s, resource=%s", tenant_id, resource) temp_credentials = temp_context.acquire_token(resource, self.user_id, _CLIENT_ID) except adal.AdalError as ex: # because user creds went through the 'common' tenant, the error here must be diff --git a/src/azure-cli-core/azure/cli/core/commands/client_factory.py b/src/azure-cli-core/azure/cli/core/commands/client_factory.py index aa762e22b3e..8361389c43a 100644 --- a/src/azure-cli-core/azure/cli/core/commands/client_factory.py +++ b/src/azure-cli-core/azure/cli/core/commands/client_factory.py @@ -110,7 +110,7 @@ def configure_common_settings(cli_ctx, client): client.config.generate_client_request_id = 'x-ms-client-request-id' not in cli_ctx.data['headers'] -def _prepare_client_kwargs(cli_ctx): +def _prepare_client_kwargs_track2(cli_ctx): """Prepare kwargs for Track 2 SDK client.""" client_kwargs = {} @@ -177,7 +177,7 @@ def _get_mgmt_service_client(cli_ctx, client_kwargs.update(kwargs) if is_track2(client_type): - client_kwargs.update(_prepare_client_kwargs(cli_ctx)) + client_kwargs.update(_prepare_client_kwargs_track2(cli_ctx)) client_kwargs['credential_scopes'] = resource_to_scopes(resource) if subscription_bound: From 944529611fe9f3fe20993d5c8e03c019e293b89c Mon Sep 17 00:00:00 2001 From: Jiashuo Li Date: Tue, 27 Oct 2020 14:41:19 +0800 Subject: [PATCH 8/8] style --- src/azure-cli-core/azure/cli/core/adal_authentication.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/adal_authentication.py b/src/azure-cli-core/azure/cli/core/adal_authentication.py index c1a5f4ab1f9..cc6c4189c59 100644 --- a/src/azure-cli-core/azure/cli/core/adal_authentication.py +++ b/src/azure-cli-core/azure/cli/core/adal_authentication.py @@ -138,9 +138,10 @@ def signed_session(self, session=None): class BasicTokenCredential: + # pylint:disable=too-few-public-methods """A Track 2 implementation of msrest.authentication.BasicTokenAuthentication.""" def __init__(self, token_entry): self.token_entry = token_entry - def get_token(self, *scopes, **kwargs): + def get_token(self, *scopes, **kwargs): # pylint:disable=unused-argument return AccessToken(self.token_entry['accessToken'], int(self.token_entry['expiresIn'] + time.time()))