40 lines
1.9 KiB
Markdown
40 lines
1.9 KiB
Markdown
# Auth Module
|
|
|
|
The Auth module owns admin authentication, current-user state, token persistence, auth routes, and route guarding.
|
|
|
|
## Source Map
|
|
|
|
| Area | Path |
|
|
| --------------------- | -------------------------------------------------- |
|
|
| Frontend module | `apps/admin/src/core/Auth/` |
|
|
| Frontend routes | `apps/admin/src/core/Auth/config/routing.tsx` |
|
|
| Frontend provider | `apps/admin/src/core/Auth/providers/AuthProvider/` |
|
|
| Frontend translations | `apps/admin/src/core/Auth/config/translation/` |
|
|
| Backend module | `backend/app/base_modules/Auth/` |
|
|
| Backend admin model | `backend/app/base_modules/Admin/model/admin.ts` |
|
|
| Auth config | `backend/config/auth.ts` |
|
|
|
|
## Documentation
|
|
|
|
| Page | Purpose |
|
|
| ------------------------- | ------------------------------------------------------------------------------------- |
|
|
| [Frontend](./frontend.md) | AuthProvider, login page, route guard, token storage, and translations. |
|
|
| [Backend](./backend.md) | Login/logout/current-user routes, validators, token behavior, and response contracts. |
|
|
|
|
## Main Capabilities
|
|
|
|
- Sign in with admin email and password.
|
|
- Store bearer token client-side.
|
|
- Verify and load current authenticated admin.
|
|
- Expose current user, permissions, login, logout, verify, and profile update methods.
|
|
- Guard app routes until authentication is known.
|
|
- Clear React Query cache on logout.
|
|
|
|
## Ownership Rules
|
|
|
|
- Auth owns session state and current user state.
|
|
- Auth owns token persistence.
|
|
- Auth owns auth route UI and auth guard widget.
|
|
- AccountSettings may call AuthProvider `updateUser` but does not own auth state.
|
|
- Permission gates consume `AuthUser.permissions` but do not fetch auth state themselves.
|