proxystore.globus¶
Globus OAuth tools.
ProxyStore provides the proxystore-globus-auth
CLI tool to give consent
to the ProxyStore Globus Application.
# basic authentication
proxystore-globus-auth
# delete old tokens
proxystore-globus-auth --delete
# give consent for specific collections
proxystore-globus-auth --collections COLLECTION_UUID COLLECTION_UUID ...
# specify additional scopes
proxystore-globus-auth --scopes SCOPE SCOPE ...
Based on Parsl's implementation and the Globus examples.
GlobusAuthFileError ¶
Bases: Exception
Exception raised if the Globus Auth token file cannot be read.
load_tokens_from_file() ¶
Load a set of saved tokens.
Parameters:
-
filepath
(
str
) –Filepath containing JSON tokens to load.
Returns:
Source code in proxystore/globus.py
save_tokens_to_file() ¶
Save a set of tokens for later use.
Parameters:
-
filepath
(
str
) –Filepath to write tokens to.
-
tokens
(
globus_sdk.OAuthTokenResponse
) –Tokens returned by the Globus API.
Source code in proxystore/globus.py
authenticate() ¶
authenticate(
client_id: str,
redirect_uri: str | None = None,
requested_scopes: Iterable[str] | None = None,
) -> globus_sdk.OAuthTokenResponse
Perform Native App auth flow.
This will print a link to auth.globus.org
where the user will
continue the authentication process. Then the function will wait on
the user to input the authorization code.
Parameters:
-
client_id
(
str
) –Globus app ID.
-
redirect_uri
(
str | None
) –The page to direct users to after authentication.
-
requested_scopes
(
Iterable[str] | None
) –Iterable of scopes on the token being requested.
Returns:
-
globus_sdk.OAuthTokenResponse
–Tokens returned by the Globus API.
Source code in proxystore/globus.py
get_authorizer() ¶
Get an authorizer for the Globus SDK.
Parameters:
Returns:
-
globus_sdk.RefreshTokenAuthorizer
–Authorizer than can be used with other parts of the Globus SDK.
Raises:
-
GlobusAuthFileError
–If
tokens_file
cannot be parsed.
Source code in proxystore/globus.py
proxystore_authenticate() ¶
proxystore_authenticate(
proxystore_dir: str | None = None,
collections: list[str] | None = None,
additional_scopes: list[str] | None = None,
) -> str
Perform auth flow for ProxyStore native app.
This is a wrapper around authenticate()
which stores tokens in the ProxyStore home directory and requests the
appropriate scopes for ProxyStore.
Alert
Globus Connect Server v5 uses consents rather than activations so users need to consent to the Transfer service accessing the specific mapped collection on behalf of the user. Read more here.
Parameters:
-
proxystore_dir
(
str | None
) –Optionally specify the proxystore home directory. Defaults to
home_dir()
. -
collections
(
list[str] | None
) –Globus Collection UUIDs to request transfer scopes for.
-
additional_scopes
(
list[str] | None
) –Extra scopes to include in the authorization request.
Returns:
-
str
–Path to saved tokens file.
Source code in proxystore/globus.py
get_proxystore_authorizer() ¶
get_proxystore_authorizer(
proxystore_dir: str | None = None,
) -> globus_sdk.RefreshTokenAuthorizer
Get an authorizer for the ProxyStore native app.
proxystore_authenticate()
or the CLI proxystore-globus-auth
should be performed prior to
calling this function to ensure tokens have been acquired.
Parameters:
-
proxystore_dir
(
str | None
) –Optionally specify the proxystore home directory. Defaults to
home_dir()
.
Returns:
-
globus_sdk.RefreshTokenAuthorizer
–Authorizer than can be used with other parts of the Globus SDK.
Source code in proxystore/globus.py
cli() ¶
Perform Globus authentication for the Transfer service.
Collections or scopes options can be strung together. E.g., request transfer scope for multiple collections with:
$ proxystore-globus-auth -c UUID -c UUID -c UUID