(connection: ExecutorServerConnection)
| 2343 | // recognize a re-login to the SAME account (update in place) versus a |
| 2344 | // different account on the same host (needs its own profile). |
| 2345 | const oauthAccountIdentity = (connection: ExecutorServerConnection): string | null => { |
| 2346 | const auth = connection.auth; |
| 2347 | if (!auth || auth.kind !== "oauth") return null; |
| 2348 | const claims = decodeAccessTokenClaims(auth.accessToken); |
| 2349 | const sub = typeof claims?.sub === "string" ? claims.sub : undefined; |
| 2350 | const org = typeof claims?.org_id === "string" ? claims.org_id : undefined; |
| 2351 | return sub && org ? `${connection.origin}|${sub}|${org}` : null; |
| 2352 | }; |
| 2353 | |
| 2354 | // Name a login's profile by the ACCOUNT it authenticates (email, falling back |
| 2355 | // to user id), not the hostname, so two accounts on the same server get |
no test coverage detected