mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-11 11:13:51 +00:00
25 lines
672 B
Python
25 lines
672 B
Python
"""Auth provider abstraction."""
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
class AuthProvider(ABC):
|
|
"""Abstract base class for authentication providers."""
|
|
|
|
@abstractmethod
|
|
async def authenticate(self, credentials: dict) -> "User | None":
|
|
"""Authenticate user with given credentials.
|
|
|
|
Returns User if authentication succeeds, None otherwise.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
async def get_user(self, user_id: str) -> "User | None":
|
|
"""Retrieve user by ID."""
|
|
raise NotImplementedError
|
|
|
|
|
|
# Import User at runtime to avoid circular imports
|
|
from app.gateway.auth.models import User # noqa: E402
|