Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changed
-------

- Renamed the ``globus_sdk.tokenstorage`` subpackage to ``globus_sdk.token_storage`` and removed the ``globus_sdk.experimental.tokenstorage`` (:pr:`1252`)
2 changes: 1 addition & 1 deletion docs/authorization/token_caching/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ recommend using the former. ``TokenStorage`` is a newer iteration of the token s
interface and includes a superset of the functionality previously supported in
``StorageAdapter``.

All constructs from both hierarchies are importable from the ``globus_sdk.tokenstorage``
All constructs from both hierarchies are importable from the ``globus_sdk.token_storage``
namespace.

.. toctree::
Expand Down
10 changes: 5 additions & 5 deletions docs/authorization/token_caching/storage_adapters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ received from authentication and token refreshes.
Usage
-----

StorageAdapter is available under the name ``globus_sdk.tokenstorage``.
StorageAdapter is available under the name ``globus_sdk.token_storage``.

Storage adapters are the main objects of this subpackage. Primarily, usage
should revolve around creating a storage adapter, potentially loading data from
Expand All @@ -27,7 +27,7 @@ For example:

import os
import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

my_file_adapter = SimpleJSONFileAdapter(os.path.expanduser("~/mytokens.json"))

Expand Down Expand Up @@ -80,15 +80,15 @@ Complete Example Usage
~~~~~~~~~~~~~~~~~~~~~~

The :ref:`Group Listing With Token Storage Script <example_group_listing_with_token_storage>`
provides a complete and runnable example which leverages ``tokenstorage``.
provides a complete and runnable example which leverages ``token_storage``.


Adapter Types
-------------

.. module:: globus_sdk.tokenstorage
.. module:: globus_sdk.token_storage

``globus_sdk.tokenstorage`` provides base classes for building your own storage
``globus_sdk.token_storage`` provides base classes for building your own storage
adapters, and several complete adapters.

The :class:`SimpleJSONFileAdapter` is good for the "simplest possible"
Expand Down
2 changes: 1 addition & 1 deletion docs/authorization/token_caching/token_storages.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _token_storages:

.. currentmodule:: globus_sdk.tokenstorage
.. currentmodule:: globus_sdk.token_storage

Token Storages
==============
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

MY_FILE_ADAPTER = SimpleJSONFileAdapter(
os.path.expanduser("~/.sdk-manage-projects.json")
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/auth_manage_projects/manage_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

MY_FILE_ADAPTER = SimpleJSONFileAdapter(
os.path.expanduser("~/.sdk-manage-projects.json")
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/create_and_run_flow/manage_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

MY_FILE_ADAPTER = SimpleJSONFileAdapter(os.path.expanduser("~/.sdk-manage-flow.json"))

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/create_and_run_flow/manage_flow_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

MY_FILE_ADAPTER = SimpleJSONFileAdapter(os.path.expanduser("~/.sdk-manage-flow.json"))

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/create_and_run_flow/run_flow_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

import globus_sdk
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

MY_FILE_ADAPTER = SimpleJSONFileAdapter(os.path.expanduser("~/.sdk-manage-flow.json"))

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/group_listing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ For simplicity, the script will prompt for login on each use.
Group Listing With Token Storage
--------------------------------

``globus_sdk.tokenstorage`` provides tools for managing refresh tokens. The
``globus_sdk.token_storage`` provides tools for managing refresh tokens. The
following example script shows how you might use this to provide a complete
script which lists the current user's groups using refresh tokens.

Expand All @@ -72,7 +72,7 @@ script which lists the current user's groups using refresh tokens.
import os

from globus_sdk import GroupsClient, NativeAppAuthClient, RefreshTokenAuthorizer
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

CLIENT_ID = "61338d24-54d5-408f-a10d-66c06b59f6d2"
AUTH_CLIENT = NativeAppAuthClient(CLIENT_ID)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Each of these pages contains an example of a piece of SDK functionality.
minimal_transfer_script/index
auth_manage_projects/index
create_and_run_flow/index
tokenstorage/index
token_storage/index
group_listing
authorization
native_app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import boto3

import globus_sdk
from globus_sdk.tokenstorage import StorageAdapter
from globus_sdk.token_storage import StorageAdapter

CLIENT_ID = "61338d24-54d5-408f-a10d-66c06b59f6d2"
tablename = "example-globus-tokenstorage"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _example_tokenstorage:
.. _example_token_storage:

Token Storage Adapters
======================
Expand All @@ -16,6 +16,6 @@ sequential scans for enumeration. The example therefore demonstrates that
key-value stores with limited or no capabilities for table scans can be used to
implement the token storage interface.

.. literalinclude:: dynamodb_tokenstorage.py
:caption: ``dynamodb_tokenstorage.py`` [:download:`download <dynamodb_tokenstorage.py>`]
.. literalinclude:: dynamodb_token_storage.py
:caption: ``dynamodb_token_storage.py`` [:download:`download <dynamodb_token_storage.py>`]
:language: python
1 change: 1 addition & 0 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ The removed alias and new module names are shown in the table below.

"``globus_sdk.experimental.auth_requirements_error``", "``globus_sdk.gare``"
"``globus_sdk.experimental.scope_parser``", "``globus_sdk.scopes``"
"``globus_sdk.experimental.tokenstorage``", "``globus_sdk.token_storage``"

``MutableScope`` is Removed, use ``Scope`` Instead
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import globus_sdk
from globus_sdk.tokenstorage import JSONTokenStorage
from globus_sdk.token_storage import JSONTokenStorage

# this is the tutorial client ID
# replace this string with your ID for production use
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/getting_started/minimal_script_noapp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Defining a token storage object is simple:
.. code-block:: python

import os
from globus_sdk.tokenstorage import JSONTokenStorage
from globus_sdk.token_storage import JSONTokenStorage

token_storage = JSONTokenStorage(
os.path.expanduser("~/.list-my-globus-groups-tokens.json")
Expand Down
43 changes: 0 additions & 43 deletions src/globus_sdk/experimental/tokenstorage.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/globus_sdk/globus_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from globus_sdk.authorizers import GlobusAuthorizer
from globus_sdk.gare import GlobusAuthorizationParameters
from globus_sdk.scopes import AuthScopes, Scope, ScopeParser, scopes_to_scope_list
from globus_sdk.tokenstorage import (
from globus_sdk.token_storage import (
ScopeRequirementsValidator,
TokenStorage,
TokenValidationError,
Expand Down
4 changes: 2 additions & 2 deletions src/globus_sdk/globus_app/authorizer_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
RefreshTokenAuthorizer,
)
from globus_sdk.services.auth import OAuthTokenResponse
from globus_sdk.tokenstorage import ValidatingTokenStorage
from globus_sdk.tokenstorage.v2.validating_token_storage import MissingTokenError
from globus_sdk.token_storage import ValidatingTokenStorage
from globus_sdk.token_storage.v2.validating_token_storage import MissingTokenError

GA = t.TypeVar("GA", bound=GlobusAuthorizer)

Expand Down
10 changes: 5 additions & 5 deletions src/globus_sdk/globus_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
LocalServerLoginFlowManager,
LoginFlowManager,
)
from globus_sdk.tokenstorage import (
from globus_sdk.token_storage import (
JSONTokenStorage,
MemoryTokenStorage,
SQLiteTokenStorage,
TokenStorage,
TokenValidationError,
)
from globus_sdk.tokenstorage.v2.validating_token_storage import IdentityMismatchError
from globus_sdk.token_storage.v2.validating_token_storage import IdentityMismatchError

from .protocols import (
IDTokenDecoderProvider,
Expand Down Expand Up @@ -71,9 +71,9 @@ class GlobusAppConfig:
:ivar str | ``TokenStorage`` | ``TokenStorageProvider`` token_storage:
A class responsible for storing and retrieving tokens.
This may be either a well-known provider (one of
:class:`"json" <globus_sdk.tokenstorage.JSONTokenStorage>`,
:class:`"sqlite" <globus_sdk.tokenstorage.SQLiteTokenStorage>`, or
:class:`"memory" <globus_sdk.tokenstorage.MemoryTokenStorage>`) or a custom
:class:`"json" <globus_sdk.token_storage.JSONTokenStorage>`,
:class:`"sqlite" <globus_sdk.token_storage.SQLiteTokenStorage>`, or
:class:`"memory" <globus_sdk.token_storage.MemoryTokenStorage>`) or a custom
storage/provider. Default: ``"json"``.

:ivar str | ``LoginFlowManager`` | ``LoginFlowManagerProvider`` login_flow_manager:
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/globus_app/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from globus_sdk import AuthLoginClient, IDTokenDecoder
from globus_sdk._types import UUIDLike
from globus_sdk.login_flows import LoginFlowManager
from globus_sdk.tokenstorage import TokenStorage, TokenValidationError
from globus_sdk.token_storage import TokenStorage, TokenValidationError

from .app import GlobusApp
from .config import GlobusAppConfig
Expand Down
2 changes: 1 addition & 1 deletion src/globus_sdk/globus_app/user_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from globus_sdk._types import ScopeCollectionType, UUIDLike
from globus_sdk.gare import GlobusAuthorizationParameters
from globus_sdk.login_flows import CommandLineLoginFlowManager, LoginFlowManager
from globus_sdk.tokenstorage import (
from globus_sdk.token_storage import (
HasRefreshTokensValidator,
NotExpiredValidator,
TokenStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _raw_load(self) -> dict[str, t.Any]:
return val

def _handle_formats(self, read_data: dict[str, t.Any]) -> _JSONFileData:
"""Handle older data formats supported by globus_sdk.tokenstorage
"""Handle older data formats supported by globus_sdk.token_storage

if the data is not in a known/recognized format, this will error
otherwise, reshape the data to the current supported format and return it
Expand Down Expand Up @@ -110,7 +110,7 @@ def store(self, token_response: globus_sdk.OAuthTokenResponse) -> None:

Given a token response, extract all the token data and write it to
``self.filename`` as JSON data.
Additionally will write the version of ``globus_sdk.tokenstorage``
Additionally will write the version of ``globus_sdk.token_storage``
which was in use.

Under the assumption that this may be running on a system with multiple
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/globus_app/test_globus_app_token_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import responses

import globus_sdk
import globus_sdk.tokenstorage
import globus_sdk.token_storage
from globus_sdk._testing import RegisteredResponse, load_response

# the JWT will have a client ID in its audience claim
Expand Down Expand Up @@ -124,7 +124,7 @@ def _count_jwk_calls():
calls = [c for c in calls if c.url == "https://auth.globus.org/jwk.json"]
return len(calls)

memory_storage = globus_sdk.tokenstorage.MemoryTokenStorage()
memory_storage = globus_sdk.token_storage.MemoryTokenStorage()
config = globus_sdk.GlobusAppConfig(
token_storage=memory_storage,
id_token_decoder=InfiniteLeewayDecoder,
Expand Down Expand Up @@ -164,7 +164,7 @@ def __init__(self, *args, **kwargs) -> None:
nonlocal init_counter
init_counter += 1

memory_storage = globus_sdk.tokenstorage.MemoryTokenStorage()
memory_storage = globus_sdk.token_storage.MemoryTokenStorage()
config = globus_sdk.GlobusAppConfig(
token_storage=memory_storage,
id_token_decoder=CustomDecoder,
Expand Down Expand Up @@ -195,7 +195,7 @@ def decode(self, *args, **kwargs) -> None:
return super().decode(*args, **kwargs)

login_client = globus_sdk.NativeAppAuthClient(client_id=CLIENT_ID_FROM_JWT)
memory_storage = globus_sdk.tokenstorage.MemoryTokenStorage()
memory_storage = globus_sdk.token_storage.MemoryTokenStorage()
config = globus_sdk.GlobusAppConfig(
token_storage=memory_storage, id_token_decoder=CustomDecoder(login_client)
)
Expand All @@ -222,7 +222,7 @@ def test_globus_app_custom_id_token_decoder_instance_can_overload_jwt_leeway(
load_response(globus_sdk.NativeAppAuthClient.oauth2_revoke_token)

login_client = globus_sdk.NativeAppAuthClient(client_id=CLIENT_ID_FROM_JWT)
memory_storage = globus_sdk.tokenstorage.MemoryTokenStorage()
memory_storage = globus_sdk.token_storage.MemoryTokenStorage()
config = globus_sdk.GlobusAppConfig(
token_storage=memory_storage,
id_token_decoder=globus_sdk.IDTokenDecoder(
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/tokenstorage/v1/test_simplejson_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from globus_sdk import __version__
from globus_sdk.tokenstorage import SimpleJSONFileAdapter
from globus_sdk.token_storage import SimpleJSONFileAdapter

IS_WINDOWS = os.name == "nt"

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/tokenstorage/v1/test_sqlite.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from globus_sdk.tokenstorage import SQLiteAdapter
from globus_sdk.token_storage import SQLiteAdapter


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/tokenstorage/v2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import globus_sdk
from globus_sdk._testing import RegisteredResponse
from globus_sdk.tokenstorage import TokenStorageData
from globus_sdk.token_storage import TokenStorageData


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from globus_sdk.tokenstorage import (
from globus_sdk.token_storage import (
JSONTokenStorage,
MemoryTokenStorage,
SQLiteTokenStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from globus_sdk import __version__
from globus_sdk.tokenstorage import JSONTokenStorage, SimpleJSONFileAdapter
from globus_sdk.token_storage import JSONTokenStorage, SimpleJSONFileAdapter

IS_WINDOWS = os.name == "nt"

Expand Down
Loading