globus-sdk-python
globus-sdk-python copied to clipboard
TokenStorage (v2)
Shortcut: https://app.shortcut.com/globus/story/33154/sdk-storageadapterv2
Change Summary (all in experimental):
- Adds
TokenStoragewhich expands uponStorageAdapterby addingnamespacesupport and requires implementing classes to supportremove_tokens_for_resource_server. It also allows passing token data as adictin addition to aOAuthTokenResponseand removeson_refreshas that was only ever an alias forstore - Adds
TokenDatawhich is a data class for tokens and metadata, notably includingidentity_idwhich is needed byValidatingTokenStorage - Adds
FileTokenStoragewhich is nearly much identical toFileAdapterbeyond implementingStorageAdapterV2instead ofStorageAdapterV2 - Adds
MemoryTokenStoragewhich remains fairly simple. - Adds
JSONTokenStoragewhich now stores data under namespaced keys and has logic for migrating storage from aSimpleJSONFileAdapter - Adds
SQLiteTokenStoragewhich is very similarSQLiteAdapterbeyond implementingStorageAdapterV2. Both classes should even be able to use the same storage without causing issues - Changes
ValidatingStorageAdapatertoValidatingTokenStoragewhich now implementsTokenStorageinstead ofStorageAdapter - Removes
IdentifiedOAuthTokenResponseas its functionality is now covered byTokenData
Notes:
- the default namespace is "DEFAULT" instead of
Noneas originally spec'd this was to not require data migration forSQLiteTokenStorageto use storage previously used bySQLiteAdapter -
namespaceis defined at class initialization rather than passed to each function as originally spec'd. This was to minimize needed changes forSQLiteAdapterand better conform withGlobusAppwhich will also have onenamespaceper instance. - Its not clear to me that adding namespace support to
MemoryTokenStoragechanged anything since initializing anotherMemoryAdapteralready partitioned the data in memory. Maybe that value should just be ignored?
📚 Documentation preview 📚: https://globus-sdk-python--980.org.readthedocs.build/en/980/