Skip to content

proxystore.globus.scopes

Build Globus Auth scopes.

ProxyStoreRelayScopes module-attribute

ProxyStoreRelayScopes = ScopeBuilder(
    "ebd5bbed-95e2-47cf-9c80-39e2064274bd",
    known_url_scopes=["relay_all"],
)

ProxyStore Relay Server scopes.

Supported Scopes:

  • relay_all

get_all_scopes_by_resource_server

get_all_scopes_by_resource_server(
    collections: Iterable[str] = (),
) -> dict[str, list[str]]

Get all scopes needed by the ProxyStore library by resource server.

This returns scopes for three resource servers: Globus Auth, Globus Transfer, and the ProxyStore Relay Server.

Parameters:

Source code in proxystore/globus/scopes.py
def get_all_scopes_by_resource_server(
    collections: Iterable[str] = (),
) -> dict[str, list[str]]:
    """Get all scopes needed by the ProxyStore library by resource server.

    This returns scopes for three resource servers: Globus Auth, Globus
    Transfer, and the ProxyStore Relay Server.

    Args:
        collections: Iterable of collection UUIDs to request consent for.
            Passed to
            [`get_transfer_scopes_by_resource_server`][proxystore.globus.scopes.get_transfer_scopes_by_resource_server].
    """
    return {
        **get_auth_scopes_by_resource_server(),
        **get_relay_scopes_by_resource_server(),
        **get_transfer_scopes_by_resource_server(collections),
    }

get_auth_scopes_by_resource_server

get_auth_scopes_by_resource_server() -> (
    dict[str, list[str]]
)

Get basic scopes for the auth API resource server.

Source code in proxystore/globus/scopes.py
def get_auth_scopes_by_resource_server() -> dict[str, list[str]]:
    """Get basic scopes for the auth API resource server."""
    return {
        AuthScopes.resource_server: [
            AuthScopes.openid,
            AuthScopes.email,
            AuthScopes.view_identity_set,
        ],
    }

get_relay_scopes_by_resource_server

get_relay_scopes_by_resource_server() -> (
    dict[str, list[str]]
)

Get all scopes for the relay server by resource server.

Source code in proxystore/globus/scopes.py
def get_relay_scopes_by_resource_server() -> dict[str, list[str]]:
    """Get all scopes for the relay server by resource server."""
    return {
        ProxyStoreRelayScopes.resource_server: [
            ProxyStoreRelayScopes.relay_all,
        ],
    }

get_transfer_scopes_by_resource_server

get_transfer_scopes_by_resource_server(
    collections: Iterable[str] = (),
) -> dict[str, list[str]]

Get scopes for the transfer API resource server.

Parameters:

  • collections (Iterable[str], default: () ) –

    Iterable of collection UUIDs to request consent for.

Source code in proxystore/globus/scopes.py
def get_transfer_scopes_by_resource_server(
    collections: Iterable[str] = (),
) -> dict[str, list[str]]:
    """Get scopes for the transfer API resource server.

    Args:
        collections: Iterable of collection UUIDs to request consent for.
    """
    transfer_scope = TransferScopes.make_mutable('all')

    for collection in collections:
        data_access_scope = GCSCollectionScopeBuilder(collection).make_mutable(
            'data_access',
        )
        transfer_scope.add_dependency(data_access_scope)

    return {TransferScopes.resource_server: [str(transfer_scope)]}

uses_data_access

uses_data_access(
    client: TransferClient, collection: str
) -> bool

Check if a collection uses data access scopes.

Parameters:

  • client (TransferClient) –

    Transfer client to use for lookup.

  • collection (str) –

    Collection ID to query.

Returns:

  • bool

    True if the collection uses a data_access scope and False otherwise.

Source code in proxystore/globus/scopes.py
def uses_data_access(client: TransferClient, collection: str) -> bool:
    """Check if a collection uses data access scopes.

    Args:
        client: Transfer client to use for lookup.
        collection: Collection ID to query.

    Returns:
        `True` if the collection uses a `data_access` scope and `False` \
        otherwise.
    """
    ep = client.get_endpoint(collection)
    if ep['entity_type'] != 'GCSv5_mapped_collection':
        return False
    return not ep['high_assurance']