auth google + jwt

This commit is contained in:
JSC
2025-06-27 13:14:29 +02:00
commit 8e2dbd8723
21 changed files with 1107 additions and 0 deletions

38
app/routes/main.py Normal file
View File

@@ -0,0 +1,38 @@
"""Main routes for the application."""
from flask import Blueprint
from app.services.decorators import get_current_user, require_auth
from app.services.greeting_service import GreetingService
bp = Blueprint("main", __name__)
@bp.route("/")
def index() -> dict[str, str]:
"""Root endpoint that returns a greeting."""
return GreetingService.get_greeting()
@bp.route("/hello")
@bp.route("/hello/<name>")
def hello(name: str | None = None) -> dict[str, str]:
"""Hello endpoint with optional name parameter."""
return GreetingService.get_greeting(name)
@bp.route("/protected")
@require_auth
def protected() -> dict[str, str]:
"""Protected endpoint that requires authentication."""
user = get_current_user()
return {
"message": f"Hello {user['name']}, this is a protected endpoint!",
"user": user
}
@bp.route("/health")
def health() -> dict[str, str]:
"""Health check endpoint."""
return {"status": "ok"}