|
1 | 1 | """Generic functions and types for working with a TokenCache that is not platform specific.""" |
2 | 2 | import os |
3 | | -import warnings |
4 | 3 | import time |
5 | 4 | import logging |
6 | 5 |
|
7 | 6 | import msal |
8 | 7 |
|
9 | 8 | from .cache_lock import CrossPlatLock |
10 | | -from .persistence import ( |
11 | | - _mkdir_p, PersistenceNotFound, FilePersistence, |
12 | | - FilePersistenceWithDataProtection, KeychainPersistence) |
| 9 | +from .persistence import _mkdir_p, PersistenceNotFound |
13 | 10 |
|
14 | 11 |
|
15 | 12 | logger = logging.getLogger(__name__) |
@@ -89,35 +86,3 @@ def find(self, credential_type, **kwargs): # pylint: disable=arguments-differ |
89 | 86 | return super(PersistedTokenCache, self).find(credential_type, **kwargs) |
90 | 87 | return [] # Not really reachable here. Just to keep pylint happy. |
91 | 88 |
|
92 | | - |
93 | | -class FileTokenCache(PersistedTokenCache): |
94 | | - """A token cache which uses plain text file to store your tokens.""" |
95 | | - def __init__(self, cache_location, **ignored): # pylint: disable=unused-argument |
96 | | - warnings.warn("You are using an unprotected token cache", RuntimeWarning) |
97 | | - warnings.warn("Use PersistedTokenCache(...) instead", DeprecationWarning) |
98 | | - super(FileTokenCache, self).__init__(FilePersistence(cache_location)) |
99 | | - |
100 | | -UnencryptedTokenCache = FileTokenCache # For backward compatibility |
101 | | - |
102 | | - |
103 | | -class WindowsTokenCache(PersistedTokenCache): |
104 | | - """A token cache which uses Windows DPAPI to encrypt your tokens.""" |
105 | | - def __init__( |
106 | | - self, cache_location, entropy='', |
107 | | - **ignored): # pylint: disable=unused-argument |
108 | | - warnings.warn("Use PersistedTokenCache(...) instead", DeprecationWarning) |
109 | | - super(WindowsTokenCache, self).__init__( |
110 | | - FilePersistenceWithDataProtection(cache_location, entropy=entropy)) |
111 | | - |
112 | | - |
113 | | -class OSXTokenCache(PersistedTokenCache): |
114 | | - """A token cache which uses native Keychain libraries to encrypt your tokens.""" |
115 | | - def __init__(self, |
116 | | - cache_location, |
117 | | - service_name='Microsoft.Developer.IdentityService', |
118 | | - account_name='MSALCache', |
119 | | - **ignored): # pylint: disable=unused-argument |
120 | | - warnings.warn("Use PersistedTokenCache(...) instead", DeprecationWarning) |
121 | | - super(OSXTokenCache, self).__init__( |
122 | | - KeychainPersistence(cache_location, service_name, account_name)) |
123 | | - |
0 commit comments