diff --git a/studio/backend/routes/data_recipe/__init__.py b/studio/backend/routes/data_recipe/__init__.py index dc0301d1c9..0d3f4febf9 100644 --- a/studio/backend/routes/data_recipe/__init__.py +++ b/studio/backend/routes/data_recipe/__init__.py @@ -5,7 +5,9 @@ from __future__ import annotations import sys from pathlib import Path -from fastapi import APIRouter +from fastapi import APIRouter, Depends + +from auth.authentication import get_current_subject backend_path = Path(__file__).parent.parent.parent if str(backend_path) not in sys.path: @@ -15,7 +17,7 @@ from .jobs import router as jobs_router from .seed import router as seed_router from .validate import router as validate_router -router = APIRouter() +router = APIRouter(dependencies=[Depends(get_current_subject)]) router.include_router(seed_router) router.include_router(validate_router) router.include_router(jobs_router) diff --git a/studio/frontend/src/features/recipe-studio/api/index.ts b/studio/frontend/src/features/recipe-studio/api/index.ts index 1b3c186659..c1d4174feb 100644 --- a/studio/frontend/src/features/recipe-studio/api/index.ts +++ b/studio/frontend/src/features/recipe-studio/api/index.ts @@ -1,3 +1,5 @@ +import { authFetch } from "@/features/auth"; + const DEFAULT_BASE = "/api/data-recipe"; export const DATA_DESIGNER_API_BASE = @@ -146,7 +148,7 @@ async function parseErrorResponse(response: Response): Promise { } async function postJson(path: string, payload: unknown): Promise { - const response = await fetch(`${DATA_DESIGNER_API_BASE}${path}`, { + const response = await authFetch(`${DATA_DESIGNER_API_BASE}${path}`, { method: "POST", headers: { "Content-Type": "application/json", @@ -162,7 +164,7 @@ async function postJson(path: string, payload: unknown): Promise { } async function getJson(path: string): Promise { - const response = await fetch(`${DATA_DESIGNER_API_BASE}${path}`); + const response = await authFetch(`${DATA_DESIGNER_API_BASE}${path}`); if (!response.ok) { throw new Error(await parseErrorResponse(response)); } @@ -273,7 +275,7 @@ export async function streamRecipeJobEvents(options: { query = `?after=${options.lastEventId}`; } - const response = await fetch( + const response = await authFetch( `${DATA_DESIGNER_API_BASE}/jobs/${options.jobId}/events${query}`, { method: "GET", diff --git a/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx b/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx index f5e3c24570..aed43d75b4 100644 --- a/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx +++ b/studio/frontend/src/features/recipe-studio/components/executions/execution-sidebar.tsx @@ -23,7 +23,7 @@ export function ExecutionSidebar({ }: ExecutionSidebarProps): ReactElement { return (