Skip to content

Commit 3d7df9d

Browse files
authored
Use Azure Identity's TokenCredential for auth. (#333)
* Use Azure Identity's TokenCredential for auth. * Remove older python package support
1 parent b44a68d commit 3d7df9d

File tree

16 files changed

+64
-376
lines changed

16 files changed

+64
-376
lines changed

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Release History
44
===============
55

6+
1.0.0-alpha0 (2024-07-12)
7+
+++++++++++++++++++
8+
* Use generic azure token credential for auth instead of custom lib.auth
9+
* Remove older Python support
10+
611
0.0.53 (2023-04-11)
712
+++++++++++++++++++
813
* Add MSAL support. Remove ADAL support

appveyor.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

azure/datalake/store/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# license information.
77
# --------------------------------------------------------------------------
88

9-
__version__ = "0.0.53"
9+
__version__ = "1.0.0-alpha0"
1010

1111
from .core import AzureDLFileSystem
1212
from .multithread import ADLDownloader

azure/datalake/store/core.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
from .enums import ExpiryOptionType
3030
from .retry import ExponentialRetryPolicy, NoRetryPolicy
3131
from .multiprocessor import multi_processor_change_acl
32+
import pathlib
3233

33-
if sys.version_info >= (3, 4):
34-
import pathlib
35-
else:
36-
import pathlib2 as pathlib
3734

3835
logger = logging.getLogger(__name__)
3936
valid_expire_types = [x.value for x in ExpiryOptionType]
@@ -46,29 +43,27 @@ class AzureDLFileSystem(object):
4643
Parameters
4744
----------
4845
store_name: str ("")
49-
Store name to connect to.
50-
token: credentials object
46+
Store name to connect to. If not supplied, we use environment variable azure_data_lake_store_name
47+
token_credential: credentials object
5148
When setting up a new connection, this contains the authorization
52-
credentials (see `lib.auth()`).
49+
credentials. Use Azure Identity to get this or define an implementation of azure.core.credentials.TokenCredential
50+
scopes: str(None)
51+
which is a list of scopes to use for the token.
5352
url_suffix: str (None)
5453
Domain to send REST requests to. The end-point URL is constructed
5554
using this and the store_name. If None, use default.
5655
api_version: str (2018-09-01)
57-
The API version to target with requests. Changing this value will
58-
change the behavior of the requests, and can cause unexpected behavior or
59-
breaking changes. Changes to this value should be undergone with caution.
56+
The API version to target with requests. Changing this value will change the behavior of the requests, and can cause unexpected behavior or breaking changes. Changes to this value should be undergone with caution.
6057
per_call_timeout_seconds: float(60)
6158
This is the timeout for each requests library call.
6259
kwargs: optional key/values
63-
See ``lib.auth()``; full list: tenant_id, username, password, client_id,
64-
client_secret, resource
60+
Other arguments forwarded to the DatalakeRESTInterface constructor.
6561
"""
6662
_singleton = [None]
6763

68-
def __init__(self, token=None, per_call_timeout_seconds=60, **kwargs):
69-
self.token = token
64+
def __init__(self, token_credential=None, **kwargs):
65+
self.token_credential = token_credential
7066
self.kwargs = kwargs
71-
self.per_call_timeout_seconds = per_call_timeout_seconds
7267
self.connect()
7368
self.dirs = {}
7469
self._emptyDirs = []
@@ -87,8 +82,8 @@ def connect(self):
8782
"""
8883
Establish connection object.
8984
"""
90-
self.azure = DatalakeRESTInterface(token=self.token, req_timeout_s=self.per_call_timeout_seconds, **self.kwargs)
91-
self.token = self.azure.token
85+
self.azure = DatalakeRESTInterface(token_credential=self.token_credential, **self.kwargs)
86+
self.token_credential = self.azure.token_credential
9287

9388
def __setstate__(self, state):
9489
self.__dict__.update(state)

0 commit comments

Comments
 (0)