1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
.. _token_storages:
.. currentmodule:: globus_sdk.tokenstorage
Token Storages
==============
Interacting with Globus services requires the use of Globus Auth-issued OAuth2 tokens.
To assist in reuse of these tokens, the SDK provides an interface to store and
retrieve this data across different storage backends.
In addition to the interface, :class:`TokenStorage`, the SDK provides concrete
implementations for some of the most common storage backends:
- :class:`JSONTokenStorage` for storing tokens in a local JSON file.
- :class:`SQLiteTokenStorage` for storing tokens in a local SQLite database.
- :class:`MemoryTokenStorage` for storing tokens in process memory.
Reference
---------
.. autoclass:: TokenStorage
:members:
:member-order: bysource
.. autoclass:: TokenStorageData
:members:
:member-order: bysource
File-based Token Storages
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: JSONTokenStorage
.. autoclass:: SQLiteTokenStorage
:members: close, iter_namespaces
Ephemeral Token Storages
^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: MemoryTokenStorage
Validating Token Storage
^^^^^^^^^^^^^^^^^^^^^^^^
Alongside the above storage-specific implementations which supply built-in token storage
to common locations, the SDK provides a unique token storage called
:class:`ValidatingTokenStorage`. This class isn't concerned with the actual storage of
tokens, but rather their validity.
A :class:`ValidatingTokenStorage` is created with one or more
:class:`TokenDataValidators <TokenDataValidator>`, each of which define a custom token
validation that will be performed during the storage or retrieval of a token. The SDK
provides a number of validators out-of-the-box to meet common validation requirements:
:ref:`token_data_validators`.
.. autoclass:: ValidatingTokenStorage
.. autoclass:: TokenDataValidator
:members:
:member-order: bysource
.. autoclass:: TokenValidationContext
:members:
:member-order: bysource
.. autoclass:: TokenValidationError
:members:
:member-order: bysource
.. _token_data_validators:
.. rubric:: Concrete Validators
.. autoclass:: NotExpiredValidator
.. autoclass:: HasRefreshTokensValidator
.. autoclass:: ScopeRequirementsValidator
.. autoclass:: UnchangingIdentityIDValidator
|