schrodinger.maestro.auth.auth0_client module

schrodinger.maestro.auth.auth0_client.get_auth0_client()

Get the singleton Auth0Client instance.

Returns:

Singleton Auth0Client instance.

class schrodinger.maestro.auth.auth0_client.Auth0Client

Bases: QObject

Singleton Auth0 client for managing authentication.

This class provides a singleton interface for authentication and manages the Auth0Worker in a persistent background thread.

signInCompleted

A pyqtSignal emitted by instances of the class.

tokensUpdated

A pyqtSignal emitted by instances of the class.

signedOut

A pyqtSignal emitted by instances of the class.

__init__()

Initialize Auth0 client, worker, and background thread.

signIn() → None

Start the sign-in process.

tryAutoSignIn() → None

Attempt to automatically sign in using a saved refresh token.

This method checks for a previously stored refresh token and attempts to obtain a valid access token. Should be called on application startup to restore the user’s session.

signOut() → None

Sign out the current user by clearing all stored tokens.

This performs a local logout, clearing all authentication data and emitting the signedOut signal to notify listeners.

handleAuthenticationToggle() → None

Handle authentication toggle by checking current state and calling appropriate method.

If user is currently authenticated, signs them out. If user is not authenticated, initiates sign-in process.

property is_authenticated: bool

Check if user is authenticated.

This returns True if a refresh token is available, indicating the user has previously signed in and we can potentially obtain valid access tokens.

Returns:

True if user has a refresh token.

property access_token: Optional[str]

Get a valid access token.

This property handles token refresh transparently: - Returns the access token immediately if it’s valid - Refreshes the token synchronously if it’s expired - Signs out and returns None if refresh fails

Returns:

Valid access token string, or None if not authenticated.