feat(auth): support reverse-proxy driven proxy auth

Closes HP-353.
This commit is contained in:
Aarnav Tale
2026-06-20 11:40:46 -04:00
parent c7822e3ec2
commit 96f2721272
24 changed files with 837 additions and 75 deletions
+17 -1
View File
@@ -3,12 +3,28 @@ import { migrate } from "drizzle-orm/node-sqlite/migrator";
import { createAuthService } from "~/server/web/auth";
export function createTestAuth() {
export function createTestAuth(
options: {
headscaleApiKey?: string;
proxyAuth?: {
enabled: boolean;
allowedCidrs?: string[];
trustedProxyCidrs?: string[];
ipHeader?: string;
userHeader?: string;
emailHeader?: string;
nameHeader?: string;
pictureHeader?: string;
};
} = {},
) {
const db = drizzle(":memory:");
migrate(db, { migrationsFolder: "./drizzle" });
const auth = createAuthService({
secret: "test-secret-key-for-unit-tests",
headscaleApiKey: options.headscaleApiKey,
proxyAuth: options.proxyAuth,
db,
cookie: {
name: "_hp_test",