mirror of
https://github.com/tale/headplane.git
synced 2026-08-13 07:06:51 +00:00
feat(auth): support reverse-proxy driven proxy auth
Closes HP-353.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user