fix(auth): correct local cookie security configuration
This commit is contained in:
parent
b584e60273
commit
155fdbb16a
67 changed files with 1003 additions and 62 deletions
13
validation-suite/frontend/atlas/lib/auth.ts
Normal file
13
validation-suite/frontend/atlas/lib/auth.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export const AUTH_COOKIE_NAME = process.env.AUTH_COOKIE_NAME ?? "atlas_access_token";
|
||||
export const AUTH_COOKIE_SECURE = process.env.AUTH_COOKIE_SECURE?.trim().toLowerCase() === "true";
|
||||
export const AUTH_COOKIE_SAMESITE = (process.env.AUTH_COOKIE_SAMESITE ?? "lax").trim().toLowerCase();
|
||||
|
||||
export function buildAuthCookieOptions(maxAge: number) {
|
||||
return {
|
||||
httpOnly: true as const,
|
||||
secure: AUTH_COOKIE_SECURE,
|
||||
sameSite: AUTH_COOKIE_SAMESITE as "lax" | "strict" | "none",
|
||||
path: "/" as const,
|
||||
maxAge
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue