(request: Request)
| 235 | /** (b) The existing cookie / bearer-session / x-api-key path. The fallback's |
| 236 | * api `Principal` shape is byte-identical to host-mcp's `Principal`. */ |
| 237 | const authenticateSession = (request: Request): Effect.Effect<Principal | null> => |
| 238 | fallback.authenticate(request).pipe( |
| 239 | Effect.catchTags({ |
| 240 | Unauthorized: () => Effect.succeed(null), |
| 241 | NoOrganization: () => Effect.succeed(null), |
| 242 | }), |
| 243 | ); |
| 244 | |
| 245 | /** |
| 246 | * Try the OAuth bearer ONLY when a Bearer header is present (no |