docs: update authentication dependency names across documentation
Updated all documentation to use correct authentication dependency names: - HTML pages: get_current_admin_from_cookie_or_header, get_current_vendor_from_cookie_or_header, get_current_customer_from_cookie_or_header - API endpoints: get_current_admin_api, get_current_vendor_api, get_current_customer_api Changes: - Updated authentication flow diagrams with correct dependency names for admin and vendor flows - Added comprehensive customer/shop authentication flow documentation - Updated cookie isolation architecture to show all three contexts (admin, vendor, shop) - Expanded security boundary enforcement diagram to include shop routes - Added customer cross-context prevention examples - Updated all code examples in frontend and backend documentation - Fixed import statements to use app.api.deps instead of app.core.auth Files updated: - docs/api/authentication-flow-diagrams.md (added customer flows) - docs/frontend/admin/page-templates.md - docs/frontend/admin/architecture.md - docs/frontend/shared/ui-components.md - docs/frontend/shared/sidebar.md - docs/development/exception-handling.md - docs/architecture/diagrams/vendor-domain-diagrams.md - docs/backend/admin-integration-guide.md - docs/backend/admin-feature-integration.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -128,7 +128,7 @@ Example:
|
||||
@router.get("/admin/dashboard")
|
||||
async def admin_dashboard_page(
|
||||
request: Request,
|
||||
current_user: User = Depends(get_current_admin_user)
|
||||
current_user: User = Depends(get_current_admin_from_cookie_or_header)
|
||||
):
|
||||
return templates.TemplateResponse(
|
||||
"admin/dashboard.html",
|
||||
@@ -364,10 +364,12 @@ Windmill Dashboard Theme:
|
||||
Auth Flow:
|
||||
1. Login → POST /api/v1/admin/auth/login
|
||||
2. API → Verify credentials + check admin role
|
||||
3. API → Return JWT token
|
||||
4. JavaScript → Store in localStorage
|
||||
5. API Client → Add to all requests
|
||||
6. Routes → Verify with get_current_admin_user
|
||||
3. API → Return JWT token + set admin_token cookie
|
||||
4. JavaScript → Store in localStorage (optional)
|
||||
5. HTML Pages → Use cookie (automatic)
|
||||
6. API Calls → Use Authorization header
|
||||
7. Routes → Verify with get_current_admin_from_cookie_or_header (HTML)
|
||||
or get_current_admin_api (API endpoints)
|
||||
|
||||
Protected Routes:
|
||||
• All /admin/* routes
|
||||
|
||||
@@ -862,7 +862,7 @@ pageLog.info('[Page Name] module loaded');
|
||||
|
||||
```python
|
||||
from fastapi import APIRouter, Request, Depends
|
||||
from app.core.auth import get_current_admin_user
|
||||
from app.api.deps import get_current_admin_from_cookie_or_header
|
||||
from app.models.database.user import User
|
||||
|
||||
router = APIRouter()
|
||||
@@ -870,12 +870,12 @@ router = APIRouter()
|
||||
@router.get("/admin/[page-route]")
|
||||
async def [page_name]_page(
|
||||
request: Request,
|
||||
current_user: User = Depends(get_current_admin_user)
|
||||
current_user: User = Depends(get_current_admin_from_cookie_or_header)
|
||||
):
|
||||
"""
|
||||
[Page Name] page
|
||||
Displays [description]
|
||||
|
||||
|
||||
Requires admin authentication.
|
||||
"""
|
||||
return templates.TemplateResponse(
|
||||
|
||||
Reference in New Issue
Block a user