Require bearer token auth for facilitator server#35
Require bearer token auth for facilitator server#35ponderingdemocritus wants to merge 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThis pull request introduces bearer token authentication to the facilitator-server application. A new module system allows pluggable authentication middleware to be registered during app initialization. A bearer-token module validates authorization headers on protected endpoints, returning 401 responses for missing or invalid tokens. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Server as Elysia Server
participant BearerModule as Bearer Token Module
participant Handler as Route Handler
Client->>Server: GET /verify (no auth header)
Server->>BearerModule: validateRequest(/verify)
BearerModule->>BearerModule: Check if /verify is protected
BearerModule->>BearerModule: Parse Authorization header (missing)
BearerModule->>Server: Return 401 Unauthorized
Server->>Client: 401 + WWW-Authenticate: Bearer realm="facilitator"
Client->>Server: GET /verify (valid token)
Server->>BearerModule: validateRequest(/verify)
BearerModule->>BearerModule: Check if /verify is protected
BearerModule->>BearerModule: Parse & validate token
BearerModule->>Server: Token valid, continue
Server->>Handler: Route to handler
Handler->>Server: 200 response
Server->>Client: 200 OK
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This adds a composable bearer-token auth module for the facilitator server and wires it into startup for /verify and /settle. The server now requires BEARER_TOKEN or BEARER_TOKENS, and tests cover valid, invalid, and unprotected-route behavior. App composition was extended to accept pluggable modules so auth can be attached cleanly.
Summary by CodeRabbit
Release Notes
New Features
Tests