Skip to content

Commit 6fd4920

Browse files
committed
Switch to MSAL 1.29+'s TokenCache.search()
1 parent a0713c4 commit 6fd4920

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

msal_extensions/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Provides auxiliary functionality to the `msal` package."""
2-
__version__ = "1.2.0b1" # Note: During/after release, copy this number to Dockerfile
2+
__version__ = "1.2.0" # Note: During/after release, copy this number to Dockerfile
33

44
from .persistence import (
55
FilePersistence,

msal_extensions/token_cache.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def modify(self, credential_type, old_entry, new_key_value_pairs=None):
6969
self._persistence.save(self.serialize())
7070
self._last_sync = time.time()
7171

72-
def _find(self, credential_type, **kwargs): # pylint: disable=arguments-differ
72+
def search(self, credential_type, **kwargs): # pylint: disable=arguments-differ
7373
# Use optimistic locking rather than CrossPlatLock(self._lock_location)
7474
retry = 3
7575
for attempt in range(1, retry + 1):
@@ -83,6 +83,6 @@ def _find(self, credential_type, **kwargs): # pylint: disable=arguments-differ
8383
else:
8484
raise # End of retry. Re-raise the exception as-is.
8585
else: # If reload encountered no error, the data is considered intact
86-
return super(PersistedTokenCache, self)._find(credential_type, **kwargs)
86+
return super(PersistedTokenCache, self).search(credential_type, **kwargs)
8787
return [] # Not really reachable here. Just to keep pylint happy.
8888

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
package_data={'': ['LICENSE']},
2020
python_requires=">=3.7",
2121
install_requires=[
22-
'msal>=1.27,<1.29', # MSAL Python 1.29+ may not have TokenCache._find()
22+
'msal>=1.29,<2', # Use TokenCache.search() from MSAL Python 1.29+
2323
'portalocker<3,>=1.4',
2424

2525
## We choose to NOT define a hard dependency on this.

tests/test_agnostic_backend.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _test_token_cache_roundtrip(persistence):
3232
assert token2["token_source"] == "cache", "App2 should hit cache written by app1"
3333
assert token1['access_token'] == token2['access_token'], "Cache should hit"
3434

35-
def test_token_cache_roundtrip_with_persistence_biulder(temp_location):
35+
def test_token_cache_roundtrip_with_persistence_builder(temp_location):
3636
_test_token_cache_roundtrip(build_encrypted_persistence(temp_location))
3737

3838
def test_token_cache_roundtrip_with_file_persistence(temp_location):

0 commit comments

Comments
 (0)