proxystore.p2p.relay.authenticate¶
Authenticate users from request headers.
Authenticator
¶
Authenticate users from request headers.
authenticate_user
¶
Authenticate user from request headers.
Parameters:
Returns:
-
UserT–User representation on authentication success.
Raises:
-
ForbiddenError–user is authenticated but is missing permissions or accessing forbidden resources.
-
UnauthorizedError–user authentication fails.
Source code in proxystore/p2p/relay/authenticate.py
NullUser
¶
Null user that is always equal to another null user instance.
NullAuthenticator
¶
GlobusUser
dataclass
¶
Globus Auth user information.
Fields are retrieved via the token introspection API.
Attributes:
-
username(str) –Identity username.
-
sub(UUID) –The Globus Auth issued identity ID of the client to which the introspected token was issued.
-
email(str | None) –Email address associated with the effective identity of the introspected token. May be
Noneif the user restricts their identity visibility. -
display_name(str | None) –Display name associated with the effective identity of the introspected token. May be
Noneif the user restricts their identity visibility.
__eq__
¶
Check equality using only Globus Auth issued identity ID.
GlobusAuthenticator
¶
GlobusAuthenticator(
client_id: str | None = None,
client_secret: str | None = None,
*,
audience: str = resource_server,
auth_client: ConfidentialAppAuthClient | None = None
)
Globus Auth authorizer.
Parameters:
-
client_id(str | None, default:None) –Globus application client ID. If either
client_idorclient_secretisNone, the values will be read from the environment variables as described inget_confidential_app_auth_client. Ignored ifauth_clientis provided. -
client_secret(str | None, default:None) –Globus application client secret. See
client_idfor details. Ignored ifauth_clientis provided. -
audience(str, default:resource_server) –Intended audience of the token. This should typically be the resource server of the the token was issued for. E.g., the UUID of the ProxyStore Relay Server application.
-
auth_client(ConfidentialAppAuthClient | None, default:None) –Optional confidential application authentication client which is used for introspecting client tokens.
Source code in proxystore/p2p/relay/authenticate.py
authenticate_user
¶
authenticate_user(headers: Mapping[str, str]) -> GlobusUser
Authenticate a Globus Auth user from request header.
This follows from the Globus Sample Data Portal example.
Parameters:
Returns:
-
GlobusUser–Globus Auth identity returned via token introspection.
Raises:
-
UnauthorizedError–if the authorization header is missing or the header is malformed.
-
ForbiddenError–if the tokens have expired or been revoked.
-
ForbiddenError–if
audienceis not included in the token's audience.
Source code in proxystore/p2p/relay/authenticate.py
get_authenticator
¶
get_authenticator(
config: RelayAuthConfig,
) -> Authenticator[Any]
Create an authenticator from a configuration.
Parameters:
-
config(RelayAuthConfig) –Configuration.
Returns:
-
Authenticator[Any]–Authenticator.
Raises:
-
ValueError–if the authentication method in the config is unknown.
Source code in proxystore/p2p/relay/authenticate.py
get_token_from_headers
¶
Extract token from websockets headers.
The header is expected to have the format Authorization: Bearer <TOKEN>.
Parameters:
Returns:
-
str–String token.
Raises:
-
UnauthorizedError–if the authorization header is missing.
-
UnauthorizedError–if the authorization header is malformed.