The system uses a unified login experience with role-specific credential validation. Authentication is handled by the FastAPI backend. Authentication has not been implemented yet.
There is only one application/client. There is no platform-admin role and no separate platform-level administration system.
For the full security stack (hashing library, JWT strategy, rate limiting), see security.md.
Only Institution Admin can sign up.
There is NO signup for:
- Students
- Faculty
- Parents
- Admin opens the signup page (
/signup) - Admin enters:
- Name
- Password
- University/Institution name
- Account is created
- Institution/University tenant is created
- Admin is authenticated (JWT set in httpOnly cookie)
- Admin is redirected to institution setup/onboarding
- Credentials: Email + Password
- Redirect:
/admin/dashboard
- Credentials: Roll Number + Password
- Example: Roll Number
20231CSE0260+ Password - Redirect:
/student/dashboard - No signup page
- Credentials: Email + Password
- Redirect:
/faculty/dashboard - No signup page
- Credentials: Child Roll Number + Password
- Redirect:
/parent/dashboard - No signup page
Client
↓
Login (/login)
↓
FastAPI Authentication API (rate-limited: 5/min per IP)
↓
Validate credentials (argon2)
↓
Determine user role
↓
Determine tenant (institution_id)
↓
Check is_login_enabled
↓
Issue JWT in httpOnly cookie
↓
Client receives authentication state via /api/auth/me
↓
Role-based dashboard redirect
JWT tokens are stored in httpOnly cookies set by the backend — not in localStorage. This prevents XSS from stealing auth tokens.
| Cookie | Lifetime | Purpose |
|---|---|---|
access_token |
15 minutes | API authentication |
refresh_token |
7 days | Obtain new access token |
See security.md for full token specification and frontend-stack.md for client-side auth handling.
| Field | Description |
|---|---|
sub |
User UUID |
role |
admin, student, faculty, parent |
institution_id |
Tenant UUID (always server-derived) |
| Method | Path | Rate limited |
|---|---|---|
| POST | /api/auth/signup |
Yes (3/min) |
| POST | /api/auth/login |
Yes (5/min) |
| POST | /api/auth/logout |
No |
| POST | /api/auth/refresh |
Yes (10/min) |
| GET | /api/auth/me |
No |
Logout clears both access_token and refresh_token httpOnly cookies and invalidates the session.
Admin-created users have an is_login_enabled status:
true— User can log infalse— User cannot log in (authentication rejected withAUTH_ACCOUNT_DISABLED)
This applies to students, faculty, and parents. Admins can enable or disable login access at any time.
Admin-initiated credential reset only in v1. No self-service "forgot password" flow. See security.md.
- Never trust
tenant_idfrom the client - Never trust role information from the client
- Backend must validate all credentials with argon2
- Disabled users must not authenticate
- Passwords must be hashed — never stored in plain text
- Rate limiting on all
/api/auth/*endpoints