(connection: ExecutorServerConnection)
| 2265 | // recognize a re-login to the SAME account (update in place) versus a |
| 2266 | // different account on the same host (needs its own profile). |
| 2267 | const oauthAccountIdentity = (connection: ExecutorServerConnection): string | null => { |
| 2268 | const auth = connection.auth; |
| 2269 | if (!auth || auth.kind !== "oauth") return null; |
| 2270 | const claims = decodeAccessTokenClaims(auth.accessToken); |
| 2271 | const sub = typeof claims?.sub === "string" ? claims.sub : undefined; |
| 2272 | const org = typeof claims?.org_id === "string" ? claims.org_id : undefined; |
| 2273 | return sub && org ? `${connection.origin}|${sub}|${org}` : null; |
| 2274 | }; |
| 2275 | |
| 2276 | // Name a login's profile by the ACCOUNT it authenticates (email, falling back |
| 2277 | // to user id), not the hostname, so two accounts on the same server get |
no test coverage detected