mdvtools.auth.auth0_provider#

Attributes#

Classes#

Auth0Provider

Helper class that provides a standard way to create an ABC using

Functions#

retry_with_exponential_backoff(func)

Decorator to implement retry logic with exponential backoff.

Module Contents#

mdvtools.auth.auth0_provider._jwks_cache[source]#
mdvtools.auth.auth0_provider._jwks_cache_expiry = None[source]#
mdvtools.auth.auth0_provider.JWKS_CACHE_DURATION = 3600[source]#
mdvtools.auth.auth0_provider.MAX_RETRIES = 3[source]#
mdvtools.auth.auth0_provider.BASE_DELAY = 1[source]#
mdvtools.auth.auth0_provider.MAX_DELAY = 8[source]#
mdvtools.auth.auth0_provider.retry_with_exponential_backoff(func)[source]#

Decorator to implement retry logic with exponential backoff.

class mdvtools.auth.auth0_provider.Auth0Provider(app, oauth: authlib.integrations.flask_client.OAuth, client_id: str, client_secret: str, domain: str)[source]#

Bases: mdvtools.auth.auth_provider.AuthProvider

Helper class that provides a standard way to create an ABC using inheritance.

_initialize_oauth()[source]#

Registers the Auth0 OAuth provider and validates OpenID Connect metadata.

login() str[source]#

Initiates the login process by redirecting to Auth0’s authorization page.

logout() flask.typing.ResponseReturnValue[source]#

Logs the user out by clearing the session and redirecting to Auth0’s logout endpoint.

get_user(token: dict | None = None) dict | None[source]#

Retrieves the user information using the provided token.

Parameters:

token – Dictionary containing access token and user details

Returns:

User information dictionary or None

get_token() str | None[source]#

Retrieves the token from the session.

Returns:

Token string or None

handle_callback() str | None[source]#

Handles the Auth0 callback and retrieves the access token.

Returns:

Access token string

is_token_valid(token)[source]#

Validates the provided token by verifying its signature using Auth0’s public keys and ensuring it’s not expired.

validate_user()[source]#

Validate the user using Auth0.

sync_users_to_db()[source]#

Syncs users from Auth0 to the application’s database using UserService and UserProjectService. Implements rate limiting and retry logic for Auth0 API calls.