Files
justin 00bfe8bfca Add local auth: AuthProvider, mailer, sessions, /api/v1/auth
Pluggable AuthProvider interface with a local (email+password) implementation, and a Mailer interface (ConsoleMailer for dev, SMTPMailer for operators). The auth service owns registration, login, opaque session issuance, email verification, and password reset (which revokes prior sessions). Endpoints under /api/v1/auth; sessions are returned as a Bearer token and set as an HttpOnly cookie.

Replaces the temporary X-User-Id shim: get_current_user now resolves a real session (Bearer or cookie). The open user-bootstrap endpoint is gone (registration replaces it). App logging is configured so the ConsoleMailer's verification/reset links are visible to self-hosters. Verified end-to-end on the deploy target, including the email-verification flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Justin Paul <justin@jpaul.me>
2026-06-06 10:51:51 -04:00

17 lines
565 B
Python

"""Development mailer: logs the would-be email (including the action link) to
stdout instead of sending. Never use in production."""
import logging
from app.integrations.mailer.base import Mailer
logger = logging.getLogger("provenance.mailer")
class ConsoleMailer(Mailer):
async def send_email_verification(self, *, to: str, link: str) -> None:
logger.info("[email] verify address for %s -> %s", to, link)
async def send_password_reset(self, *, to: str, link: str) -> None:
logger.info("[email] password reset for %s -> %s", to, link)