Description
Build the authenticate middleware (verifies JWT, attaches req.user) and a requireRole(...) middleware for RBAC, matching the four roles in the schema (ADMIN, ORGANIZATION, DONOR, BENEFICIARY).
Acceptance Criteria
- Missing/invalid/expired token returns 401 with a clear error message.
- requireRole returns 403 when the authenticated user's role isn't permitted.
- Middleware is unit tested for all four roles plus the unauthenticated case.
- At least one existing or stub route demonstrates the middleware in use.
- Documented in openapi.yaml via security: [{bearerAuth: []}] on the protected route(s).
Suggested reward: $20-$30
Description
Build the authenticate middleware (verifies JWT, attaches req.user) and a requireRole(...) middleware for RBAC, matching the four roles in the schema (ADMIN, ORGANIZATION, DONOR, BENEFICIARY).
Acceptance Criteria
Suggested reward: $20-$30