Authentication & Architecture
Cross-subdomain SSO, cookie handling, and Role-Based Access Control (RBAC) across srazone.et
Architecture & Shared Authentication
SraHub uses a modern Single Sign-On (SSO) model based on shared root-domain cookies (.srazone.et). This allows users to register or sign in once and seamlessly navigate between the main job seeker web portal (srazone.et) and the employer portal (employeer.srazone.et).
Shared Cookie SSO Flow
+--------------------------+ +-------------------------------+
| https://srazone.et | | https://employeer.srazone.et |
| (Web Portal) | | (Employer Portal) |
+------------+-------------+ +---------------+---------------+
| |
+-------------------+-------------------+
|
Cookies: sra_access_token
Domain: .srazone.et
|
v
+------------------------+
| https://api.srazone.et |
| (NestJS API) |
+------------------------+Key Subdomains
- Root Domain:
https://srazone.et - Employer Subdomain:
https://employeer.srazone.et - API Subdomain:
https://api.srazone.et - Admin Subdomain:
https://admin.srazone.et
Implementation Details
- Cookie Domain Scope: Both
apps/webandapps/employerset auth cookies withdomain=.srazone.etin production environments. - Bearer Token Transmission: Client-side API clients automatically read
sra_access_tokenfrom cookies and send it via the standardAuthorization: Bearer <token>HTTP header to the backend API. - Role-Based Access Control (RBAC):
job_seeker: Default role assigned during signup onhttps://srazone.et.employer: Role assigned during company registration onhttps://employeer.srazone.et.admin/super_admin: Internal administrative access athttps://admin.srazone.et.
// Role assignment example in registration payload
{
"email": "hr@company.com",
"password": "...",
"displayName": "Acme Ethiopia",
"role": "employer"
}