docs: add authentication dependencies guide

Add comprehensive guide explaining when to use each authentication
dependency:

- get_current_admin_from_cookie_or_header vs get_current_admin_api
- get_current_vendor_from_cookie_or_header vs get_current_vendor_api
- get_current_customer_from_cookie_or_header vs get_current_customer_api

Key distinctions:
- HTML pages (templates) → use _from_cookie_or_header (accepts cookies)
- API endpoints (JSON) → use _api (header-only, no cookies, CSRF-safe)
- Login pages → use _optional (returns None instead of exception)

Includes:
- Complete reference table
- When to use which dependency
- Migration guide from old names
- Code examples for each scenario
- Quick reference cheat sheet

This clarifies the naming change from get_current_admin_user to the
more specific variants and helps developers choose the right dependency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 16:03:03 +01:00
parent c1ff0a00db
commit ac1017928c
2 changed files with 192 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ nav:
- Development:
- Icons Guide: development/icons_guide.md
- Naming Conventions: development/naming-conventions.md
- Auth Dependencies Guide: development/AUTH_DEPENDENCIES_GUIDE.md
- Database Migrations: development/database-migrations.md
- Database Seeder:
- Documentation: development/database-seeder/DATABASE_SEEDER_DOCUMENTATION.md