FR-01 — IAM Implementation Plan
Introduction
The FR-01 Implementation Plan defines the development sequence for delivering SalesFam Authentication, Identity & Access Management. It translates the approved FR-01 requirements and technical design into implementation tasks covering the IAM foundation, registration and verification, onboarding, authentication, session management, password recovery, and access control.
Implementation Scope
The implementation covers:
- IAM foundation and data models
- Account registration and verification
- Account-type selection and onboarding
- Login, logout, and session refresh
- Password recovery and reset
- Role-based access control
- Account-status enforcement
- IAM integration and testing
Completion
FR-01 is considered complete when the defined IAM flows are implemented, integrated, secured, and verified against the acceptance criteria established in the Functional Requirements.
1. Implementation Order
The order is intentional: lower-level foundations are built before the features that depend on them.
2. Implementation Tasks
| ID | Task | Depends On |
|---|---|---|
| IAM-IMP-01 | Set up IAM module structure and shared configuration | — |
| IAM-IMP-02 | Implement IAM database models and relationships | IAM-IMP-01 |
| IAM-IMP-03 | Implement input validation and standard API errors | IAM-IMP-01 |
| IAM-IMP-04 | Implement verification-code generation, storage, expiration, and resend rules | IAM-IMP-02 |
| IAM-IMP-05 | Implement account registration | IAM-IMP-02, IAM-IMP-03, IAM-IMP-04 |
| IAM-IMP-06 | Implement email verification | IAM-IMP-04, IAM-IMP-05 |
| IAM-IMP-07 | Implement account-type selection | IAM-IMP-06 |
| IAM-IMP-08 | Implement Company onboarding | IAM-IMP-07 |
| IAM-IMP-09 | Implement Sales Representative onboarding | IAM-IMP-07 |
| IAM-IMP-10 | Implement login and authenticated session creation | IAM-IMP-02, IAM-IMP-03 |
| IAM-IMP-11 | Implement session refresh | IAM-IMP-10 |
| IAM-IMP-12 | Implement logout and session revocation | IAM-IMP-10 |
| IAM-IMP-13 | Implement forgot-password flow | IAM-IMP-02 |
| IAM-IMP-14 | Implement reset-password flow | IAM-IMP-13 |
| IAM-IMP-15 | Implement authentication middleware | IAM-IMP-10 |
| IAM-IMP-16 | Implement RBAC and account-status checks | IAM-IMP-15 |
| IAM-IMP-17 | Apply resource-access protection to IAM endpoints | IAM-IMP-16 |
| IAM-IMP-18 | Test complete IAM flows and edge cases | All above |
3. Implementation Sequence
Phase A — Foundation
Complete: IAM-IMP-01 → IAM-IMP-03. This establishes the module structure, database access, validation, and common error handling.
Phase B — Registration & Verification
Complete: IAM-IMP-04 → IAM-IMP-06. Flow: Register → Verification Code → Verify Email.
Phase C — Onboarding
Complete: IAM-IMP-07 → IAM-IMP-09. Flow: Verified User → Choose Account Type → Company Onboarding / Rep Onboarding.
Phase D — Authentication & Sessions
Complete: IAM-IMP-10 → IAM-IMP-12. Flow: Login → Session → Refresh / Logout.
Phase E — Password Recovery
Complete: IAM-IMP-13 → IAM-IMP-14. Flow: Forgot Password → Reset Password.
Phase F — Authorization
Complete: IAM-IMP-15 → IAM-IMP-17. This establishes the protection layer required by the rest of SalesFam: Request → Authentication → Account Status → Role / Permission → Resource Access → Operation.
Phase G — Verification
Complete: IAM-IMP-18. Test the complete lifecycle rather than testing endpoints only in isolation.
4. FR-01 Completion Criteria
FR-01 is complete when:
- A user can register and verify their account.
- A verified user can select Company or Rep.
- The selected onboarding flow can be completed.
- Users can log in and maintain a valid session.
- Users can refresh and terminate sessions.
- Users can recover and reset their password.
- Protected endpoints enforce authentication.
- Role-based access is enforced server-side.
- Account status restrictions are enforced.
- Users cannot access another user's protected resources.
- The complete IAM flow passes integration testing.