From 6664efaa137f47fb64b997898c68803e86e2a396 Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 13 Oct 2025 15:07:23 -0700 Subject: [PATCH] Fix up UI around resource auth headers --- server/routers/resource/listResources.ts | 9 +++++++-- .../settings/resources/[niceId]/authentication/page.tsx | 2 +- src/app/[orgId]/settings/resources/page.tsx | 3 ++- src/components/ResourceInfoBox.tsx | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/server/routers/resource/listResources.ts b/server/routers/resource/listResources.ts index 27605be6..22a10605 100644 --- a/server/routers/resource/listResources.ts +++ b/server/routers/resource/listResources.ts @@ -1,6 +1,6 @@ import { Request, Response, NextFunction } from "express"; import { z } from "zod"; -import { db } from "@server/db"; +import { db, resourceHeaderAuth } from "@server/db"; import { resources, userResources, @@ -56,7 +56,8 @@ function queryResources(accessibleResourceIds: number[], orgId: string) { proxyPort: resources.proxyPort, enabled: resources.enabled, domainId: resources.domainId, - niceId: resources.niceId + niceId: resources.niceId, + headerAuthId: resourceHeaderAuth.headerAuthId }) .from(resources) .leftJoin( @@ -67,6 +68,10 @@ function queryResources(accessibleResourceIds: number[], orgId: string) { resourcePincode, eq(resourcePincode.resourceId, resources.resourceId) ) + .leftJoin( + resourceHeaderAuth, + eq(resourceHeaderAuth.resourceId, resources.resourceId) + ) .where( and( inArray(resources.resourceId, accessibleResourceIds), diff --git a/src/app/[orgId]/settings/resources/[niceId]/authentication/page.tsx b/src/app/[orgId]/settings/resources/[niceId]/authentication/page.tsx index e0ab26c7..56c989c3 100644 --- a/src/app/[orgId]/settings/resources/[niceId]/authentication/page.tsx +++ b/src/app/[orgId]/settings/resources/[niceId]/authentication/page.tsx @@ -837,7 +837,7 @@ export default function ResourceAuthenticationPage() { {authInfo.headerAuth - ? t("resourceHeaderAuthProtection") + ? t("resourceHeaderAuthProtectionEnabled") : t( "resourceHeaderAuthProtectionDisabled" )} diff --git a/src/app/[orgId]/settings/resources/page.tsx b/src/app/[orgId]/settings/resources/page.tsx index 97abdd4c..f4ba9d16 100644 --- a/src/app/[orgId]/settings/resources/page.tsx +++ b/src/app/[orgId]/settings/resources/page.tsx @@ -86,7 +86,8 @@ export default async function ResourcesPage(props: ResourcesPageProps) { : resource.sso || resource.pincodeId !== null || resource.passwordId !== null || - resource.whitelist + resource.whitelist || + resource.headerAuthId ? "protected" : "not_protected", enabled: resource.enabled, diff --git a/src/components/ResourceInfoBox.tsx b/src/components/ResourceInfoBox.tsx index 96954be4..0a9939ff 100644 --- a/src/components/ResourceInfoBox.tsx +++ b/src/components/ResourceInfoBox.tsx @@ -43,7 +43,8 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) { {authInfo.password || authInfo.pincode || authInfo.sso || - authInfo.whitelist ? ( + authInfo.whitelist || + authInfo.headerAuth ? (
{t("protected")}