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
16
apps/stock/web-api/src/http-security.ts
Normal file
16
apps/stock/web-api/src/http-security.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { createHttpSecurity, httpSecurityOptions, type HttpSecurityOptions } from '@stock-bot/di';
|
||||
import type { IServiceContainer } from '@stock-bot/services';
|
||||
import { ResearchAgentsService } from './services/research-agents.service';
|
||||
|
||||
/** The web server shares this security instance between HTTP and WebSocket routes. */
|
||||
export function createWebApiSecurity(
|
||||
container: IServiceContainer,
|
||||
options: HttpSecurityOptions = httpSecurityOptions()
|
||||
) {
|
||||
const agents = new ResearchAgentsService(container);
|
||||
return createHttpSecurity({
|
||||
...options,
|
||||
browserSessions: true,
|
||||
resolveResearchCredential: request => agents.authenticate(request),
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue