(session: typeof sessionA, server: typeof serverA)
| 1343 | // session subject, which is what the colliding pair needs) against its |
| 1344 | // own authorization server, so token provenance is observable. |
| 1345 | const connect = (session: typeof sessionA, server: typeof serverA) => |
| 1346 | Effect.gen(function* () { |
| 1347 | yield* session.acme.seed(); |
| 1348 | yield* session.oauth.createClient({ |
| 1349 | owner: "org", |
| 1350 | slug: CLIENT, |
| 1351 | authorizationUrl: server.authorizationEndpoint, |
| 1352 | tokenUrl: server.tokenEndpoint, |
| 1353 | grant: "authorization_code", |
| 1354 | clientId: "test-client", |
| 1355 | clientSecret: "test-secret", |
| 1356 | }); |
| 1357 | const started = yield* session.oauth.start({ |
| 1358 | owner: "user", |
| 1359 | client: CLIENT, |
| 1360 | clientOwner: "org", |
| 1361 | name: ConnectionName.make("mine"), |
| 1362 | integration: INTEG, |
| 1363 | template: TEMPLATE, |
| 1364 | }); |
| 1365 | expect(started.status).toBe("redirect"); |
| 1366 | if (started.status !== "redirect") return; |
| 1367 | const callback = yield* server.completeAuthorizationCodeFlow({ |
| 1368 | authorizationUrl: started.authorizationUrl, |
| 1369 | }); |
| 1370 | yield* session.oauth.complete({ state: started.state, code: callback.code }); |
| 1371 | }); |
| 1372 | yield* connect(sessionA, serverA); |
| 1373 | yield* connect(sessionB, serverB); |
| 1374 |
no test coverage detected