Files
gatos-tejada/api/src/api/services/auth/provider.py
T
kiskaadee ccb53d87a2 feat(api): scaffold async backend with SSO adapter, consensus engine, and TDD suite
- Adopt PEP 517/518 src-layout for api package using hatchling and uv.
- Configure dependencies: FastAPI, async SQLAlchemy 2.0, GeoAlchemy2, pgvector, and Pydantic v2.
- Implement decoupled SSO Identity Provider protocol with MockDevAdapter, GoogleOAuthAdapter, and AuthService.
- Define PostGIS and pgvector SQLAlchemy database models in api/db_models/.
- Implement pure-logic Consensus Engine with Haversine distance, Velocity Checks, and cluster confidence scoring.
- Add test suite in api/tests/ with 18 unit/integration tests and configure Ruff and Pyright quality gates.
2026-10-13 06:50:16 -05:00

28 lines
659 B
Python

from dataclasses import dataclass
from typing import Protocol
@dataclass(frozen=True)
class AuthUserIdentity:
"""
Normalized user identity returned by any identity provider.
"""
email: str
name: str
provider_user_id: str
avatar_url: str | None = None
class IdentityProvider(Protocol):
"""
Contract for pluggable SSO Identity Providers (Google, Authelia, Mock, etc.).
"""
async def verify_token(self, token: str) -> AuthUserIdentity:
"""
Verify external provider token and return normalized identity.
Raises ValueError or equivalent on invalid or expired token.
"""
...