diff --git a/ui/app/api/auth/[...nextauth]/route.ts b/ui/app/api/auth/[...nextauth]/route.ts index 28adbada3..812db7da4 100644 --- a/ui/app/api/auth/[...nextauth]/route.ts +++ b/ui/app/api/auth/[...nextauth]/route.ts @@ -1,12 +1,11 @@ import { getKafkaClusters } from "@/api/kafka/actions"; import { ClusterList } from "@/api/kafka/schema"; -import { makeOauthTokenProvider } from "@/app/api/auth/[...nextauth]/oauth-token"; import { logger } from "@/utils/logger"; import NextAuth, { AuthOptions } from "next-auth"; import { Provider } from "next-auth/providers/index"; import { NextRequest, NextResponse } from "next/server"; import { makeAnonymous } from "./anonymous"; -import { makeOauthProvider } from "./keycloak"; +import { makeOauthTokenProvider } from "./oauth-token"; import { makeScramShaProvider } from "./scram"; const log = logger.child({ module: "auth" }); diff --git a/ui/components/ClustersTable.tsx b/ui/components/ClustersTable.tsx index 877fc4134..c5429eea1 100644 --- a/ui/components/ClustersTable.tsx +++ b/ui/components/ClustersTable.tsx @@ -28,13 +28,13 @@ export function ClustersTable({ renderHeader={({ column, Th }) => { switch (column) { case "name": - return {t("ClustersTable.name")}; + return {t("ClustersTable.name")}; case "version": - return {t("ClustersTable.kafka_version")}; + return {t("ClustersTable.kafka_version")}; case "namespace": - return {t("ClustersTable.project")}; + return {t("ClustersTable.project")}; case "login": - return ; + return ; } }} renderCell={({ key, column, row, Td }) => { diff --git a/ui/middleware.ts b/ui/middleware.ts index 7898498a7..1cac4b75c 100644 --- a/ui/middleware.ts +++ b/ui/middleware.ts @@ -3,8 +3,12 @@ import withAuth from "next-auth/middleware"; import createIntlMiddleware from "next-intl/middleware"; import { NextRequest, NextResponse } from "next/server"; -const publicPages = ["/kafka/\\d/login", "/cluster", "/"]; -const protectedPages = ["/kafka/\\d/.*"]; +import { logger } from "@/utils/logger"; + +const log = logger.child({ module: "middleware" }); + +const publicPages = ["/kafka/[^/]+/login", "/cluster", "/"]; +const protectedPages = ["/kafka/[^/]+/.*"]; const intlMiddleware = createIntlMiddleware({ // A list of all locales that are supported @@ -47,14 +51,18 @@ const protectedPathnameRegex = RegExp( ); export default async function middleware(req: NextRequest) { - const isPublicPage = publicPathnameRegex.test(req.nextUrl.pathname); - const isProtectedPage = protectedPathnameRegex.test(req.nextUrl.pathname); + const requestPath = req.nextUrl.pathname; + const isPublicPage = publicPathnameRegex.test(requestPath); + const isProtectedPage = protectedPathnameRegex.test(requestPath); if (isPublicPage) { + log.trace({ requestPath: requestPath }, "public page"); return intlMiddleware(req); } else if (isProtectedPage) { + log.trace({ requestPath: requestPath }, "protected page"); return (authMiddleware as any)(req); } else { + log.debug({ requestPath: requestPath, publicPathnameRegex: publicPathnameRegex, protectedPathnameRegex: protectedPathnameRegex }, "neither public nor protected!"); return NextResponse.redirect(new URL("/", req.url)); } }