Fix up UI around resource auth headers

This commit is contained in:
Owen
2025-10-13 15:07:23 -07:00
parent e5ee96cf52
commit 6664efaa13
4 changed files with 12 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import { Request, Response, NextFunction } from "express"; import { Request, Response, NextFunction } from "express";
import { z } from "zod"; import { z } from "zod";
import { db } from "@server/db"; import { db, resourceHeaderAuth } from "@server/db";
import { import {
resources, resources,
userResources, userResources,
@@ -56,7 +56,8 @@ function queryResources(accessibleResourceIds: number[], orgId: string) {
proxyPort: resources.proxyPort, proxyPort: resources.proxyPort,
enabled: resources.enabled, enabled: resources.enabled,
domainId: resources.domainId, domainId: resources.domainId,
niceId: resources.niceId niceId: resources.niceId,
headerAuthId: resourceHeaderAuth.headerAuthId
}) })
.from(resources) .from(resources)
.leftJoin( .leftJoin(
@@ -67,6 +68,10 @@ function queryResources(accessibleResourceIds: number[], orgId: string) {
resourcePincode, resourcePincode,
eq(resourcePincode.resourceId, resources.resourceId) eq(resourcePincode.resourceId, resources.resourceId)
) )
.leftJoin(
resourceHeaderAuth,
eq(resourceHeaderAuth.resourceId, resources.resourceId)
)
.where( .where(
and( and(
inArray(resources.resourceId, accessibleResourceIds), inArray(resources.resourceId, accessibleResourceIds),

View File

@@ -837,7 +837,7 @@ export default function ResourceAuthenticationPage() {
<Bot size="14" /> <Bot size="14" />
<span> <span>
{authInfo.headerAuth {authInfo.headerAuth
? t("resourceHeaderAuthProtection") ? t("resourceHeaderAuthProtectionEnabled")
: t( : t(
"resourceHeaderAuthProtectionDisabled" "resourceHeaderAuthProtectionDisabled"
)} )}

View File

@@ -86,7 +86,8 @@ export default async function ResourcesPage(props: ResourcesPageProps) {
: resource.sso || : resource.sso ||
resource.pincodeId !== null || resource.pincodeId !== null ||
resource.passwordId !== null || resource.passwordId !== null ||
resource.whitelist resource.whitelist ||
resource.headerAuthId
? "protected" ? "protected"
: "not_protected", : "not_protected",
enabled: resource.enabled, enabled: resource.enabled,

View File

@@ -43,7 +43,8 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
{authInfo.password || {authInfo.password ||
authInfo.pincode || authInfo.pincode ||
authInfo.sso || authInfo.sso ||
authInfo.whitelist ? ( authInfo.whitelist ||
authInfo.headerAuth ? (
<div className="flex items-start space-x-2 text-green-500"> <div className="flex items-start space-x-2 text-green-500">
<ShieldCheck className="w-4 h-4 mt-0.5" /> <ShieldCheck className="w-4 h-4 mt-0.5" />
<span>{t("protected")}</span> <span>{t("protected")}</span>