fix(api): wire research credentials into server security (RP20)
This commit is contained in:
parent
fd90d17214
commit
7de497e9b0
5 changed files with 274 additions and 26 deletions
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import { Hono } from 'hono';
|
||||
import { cors } from 'hono/cors';
|
||||
import { createHttpSecurity, httpSecurityOptions, type HttpSecurity } from '@stock-bot/di';
|
||||
import type { HttpSecurity } from '@stock-bot/di';
|
||||
import type { IServiceContainer } from '@stock-bot/handlers';
|
||||
import { ResearchAgentsService } from '../services/research-agents.service';
|
||||
import { createWebApiSecurity } from '../http-security';
|
||||
import { createBacktestRoutes } from './backtest.routes';
|
||||
import { createBacktestV2Routes } from './backtests-v2.routes';
|
||||
import { createDatasetRoutes } from './datasets.routes';
|
||||
|
|
@ -30,14 +30,7 @@ export function createRoutes(
|
|||
suppliedSecurity?: HttpSecurity,
|
||||
integrations?: { paperOrchestratorOrigin?: string }
|
||||
): Hono {
|
||||
const agents = new ResearchAgentsService(container);
|
||||
const security =
|
||||
suppliedSecurity ??
|
||||
createHttpSecurity({
|
||||
...httpSecurityOptions(),
|
||||
browserSessions: true,
|
||||
resolveResearchCredential: request => agents.authenticate(request),
|
||||
});
|
||||
const security = suppliedSecurity ?? createWebApiSecurity(container);
|
||||
const app = new Hono();
|
||||
|
||||
// Add CORS middleware
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue