(session: typeof sessionA, server: typeof serverA)
| 1212 | // session subject, which is what the colliding pair needs) against its |
| 1213 | // own authorization server, so token provenance is observable. |
| 1214 | const connect = (session: typeof sessionA, server: typeof serverA) => |
| 1215 | Effect.gen(function* () { |
| 1216 | yield* session.acme.seed(); |
| 1217 | yield* session.oauth.createClient({ |
| 1218 | owner: "org", |
| 1219 | slug: CLIENT, |
| 1220 | authorizationUrl: server.authorizationEndpoint, |
| 1221 | tokenUrl: server.tokenEndpoint, |
| 1222 | grant: "authorization_code", |
| 1223 | clientId: "test-client", |
| 1224 | clientSecret: "test-secret", |
| 1225 | }); |
| 1226 | const started = yield* session.oauth.start({ |
| 1227 | owner: "user", |
| 1228 | client: CLIENT, |
| 1229 | clientOwner: "org", |
| 1230 | name: ConnectionName.make("mine"), |
| 1231 | integration: INTEG, |
| 1232 | template: TEMPLATE, |
| 1233 | }); |
| 1234 | expect(started.status).toBe("redirect"); |
| 1235 | if (started.status !== "redirect") return; |
| 1236 | const callback = yield* server.completeAuthorizationCodeFlow({ |
| 1237 | authorizationUrl: started.authorizationUrl, |
| 1238 | }); |
| 1239 | yield* session.oauth.complete({ state: started.state, code: callback.code }); |
| 1240 | }); |
| 1241 | yield* connect(sessionA, serverA); |
| 1242 | yield* connect(sessionB, serverB); |
| 1243 |
no test coverage detected