( response: NextResponse, cookiePrefix: DeploymentAuthKind, deploymentId: string, authType: string, encryptedPassword?: string | null )
| 90 | * Sets an authentication cookie for a deployment |
| 91 | */ |
| 92 | export function setDeploymentAuthCookie( |
| 93 | response: NextResponse, |
| 94 | cookiePrefix: DeploymentAuthKind, |
| 95 | deploymentId: string, |
| 96 | authType: string, |
| 97 | encryptedPassword?: string | null |
| 98 | ): void { |
| 99 | const token = generateAuthToken(deploymentId, authType, encryptedPassword) |
| 100 | response.cookies.set({ |
| 101 | name: deploymentAuthCookieName(cookiePrefix, deploymentId), |
| 102 | value: token, |
| 103 | httpOnly: true, |
| 104 | secure: !isDev, |
| 105 | sameSite: 'lax', |
| 106 | path: '/', |
| 107 | maxAge: 60 * 60 * 24, |
| 108 | }) |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Checks if an email matches the allowed emails list (exact match or domain |
no test coverage detected