dataflow.auth.supabase¶

Attributes¶

Classes¶

SupabaseAuth

Authentication provider using Supabase JWT.

Functions¶

get_auth_instance()

Get the auth instance for dependency injection.

get_current_user([credentials, auth])

Verify the token and return the user ID.

require_auth([user_id])

Require authentication for a route.

Module Contents¶

class dataflow.auth.supabase.SupabaseAuth(server_config: haive.dataflow.auth.config.environment.SupabaseServerConfig | None = None)¶

Authentication provider using Supabase JWT.

Parameters:

server_config (haive.dataflow.auth.config.environment.SupabaseServerConfig | None)

get_user_id(token: str) str | None¶

Extract user ID from token.

Parameters:

token (str)

Return type:

str | None

verify_token(token: str) dict[str, Any] | None¶

Verify Supabase JWT token and return payload if valid.

Parameters:

token (str)

Return type:

dict[str, Any] | None

config¶
dataflow.auth.supabase.get_auth_instance()¶

Get the auth instance for dependency injection.

async dataflow.auth.supabase.get_current_user(credentials: fastapi.security.HTTPAuthorizationCredentials | None = Depends(security), auth: SupabaseAuth = Depends(get_auth_instance)) str | None¶

Verify the token and return the user ID.

This is for frontend API routes - can be used with FastAPI Depends.

Parameters:
  • credentials (fastapi.security.HTTPAuthorizationCredentials | None)

  • auth (SupabaseAuth)

Return type:

str | None

async dataflow.auth.supabase.require_auth(user_id: str | None = Depends(get_current_user)) str¶

Require authentication for a route.

Raises HTTPException if not authenticated.

Parameters:

user_id (str | None)

Return type:

str

dataflow.auth.supabase.logger¶
dataflow.auth.supabase.security¶