app/lab/access.server.ts
14 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| labIdentity | 13 to 15 | 1 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/lib/access.server.ts. Imported by app/routes/workspace.tsx.
Source
import { verifyAccessRequest, type AccessIdentity, type TeamKeys } from "~/lib/access.server";
/**
* Who the lab's own Cloudflare Access application says is asking (capsid docs/design/design-identity-roles.md, "How a
* person signs in"). /lab sits behind `dustinedwards-lab-login`, a separate application from /admin's, so its token
* carries ACCESS_LAB_AUD and never ACCESS_AUD: a /admin token is refused here for its audience, and a /lab token is
* refused at /admin for the same reason. Being admitted by Access proves only an email; the person's row in `members`
* decides what they may do (app/lab/actor.server.ts).
*
* Only the header is read, never the `CF_Authorization` cookie: two Access applications on one host each set that
* cookie, and the header is the one Access adds for the application in front of this path.
*/
export function labIdentity(env: Env, request: Request, keys?: TeamKeys): Promise<AccessIdentity> {
return verifyAccessRequest(env, request, { audience: env.ACCESS_LAB_AUD, cookie: false }, keys);
}