From 6e7bfecbbcedb13d3feb1b05d4aec504586bb259 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Thu, 10 Apr 2025 14:34:52 +0200 Subject: [PATCH 1/2] chore(docs,cli): remove python-only label for custom auth, add test for custom auth in CLI --- docs/docs/concepts/auth.md | 4 ---- libs/cli/tests/unit_tests/test_config.py | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/docs/concepts/auth.md b/docs/docs/concepts/auth.md index df24aa134..cfe37ed7b 100644 --- a/docs/docs/concepts/auth.md +++ b/docs/docs/concepts/auth.md @@ -2,10 +2,6 @@ LangGraph Platform provides a flexible authentication and authorization system that can integrate with most authentication schemes. -!!! note "Python only" - - We currently only support custom authentication and authorization in Python deployments with `langgraph-api>=0.0.11`. Support for LangGraph.JS will be added soon. - ## Core Concepts ### Authentication vs Authorization diff --git a/libs/cli/tests/unit_tests/test_config.py b/libs/cli/tests/unit_tests/test_config.py index cb27b0d0c..8b49bbe38 100644 --- a/libs/cli/tests/unit_tests/test_config.py +++ b/libs/cli/tests/unit_tests/test_config.py @@ -494,6 +494,7 @@ def test_config_to_docker_nodejs(): "node_version": "20", "graphs": graphs, "dockerfile_lines": ["ARG meow", "ARG foo"], + "auth": {"path": "./graphs/auth.mts:auth"}, "ui": {"agent": "./graphs/agent.ui.jsx"}, "ui_config": {"shared": ["nuqs"]}, } @@ -505,6 +506,7 @@ ARG meow ARG foo ADD . /deps/unit_tests RUN cd /deps/unit_tests && npm i +ENV LANGGRAPH_AUTH='{"path": "./graphs/auth.mts:auth"}' ENV LANGSERVE_GRAPHS='{"agent": "./graphs/agent.js:graph"}' ENV LANGGRAPH_UI='{"agent": "./graphs/agent.ui.jsx"}' ENV LANGGRAPH_UI_CONFIG='{"shared": ["nuqs"]}' From 794dc1ae92c4ce088b759bfb4c738dbac97ac216 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Thu, 10 Apr 2025 15:06:55 +0200 Subject: [PATCH 2/2] docs(api): add custom auth docs --- docs/docs/concepts/auth.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/concepts/auth.md b/docs/docs/concepts/auth.md index cfe37ed7b..91980ecc0 100644 --- a/docs/docs/concepts/auth.md +++ b/docs/docs/concepts/auth.md @@ -142,7 +142,7 @@ The returned user information is available: After authentication, LangGraph calls your [`@auth.on`](../cloud/reference/sdk/python_sdk_ref.md#langgraph_sdk.auth.Auth.on) handlers to control access to specific resources (e.g., threads, assistants, crons). These handlers can: -1. Add metadata to be saved during resource creation by mutating the `value["metadata"]` dictionary directly. See the [supported actions table](##supported-actions) for the list of types the value can take for each action. +1. Add metadata to be saved during resource creation by mutating the `value["metadata"]` dictionary directly. See the [supported actions table](#supported-actions) for the list of types the value can take for each action. 2. Filter resources by metadata during search/list or read operations by returning a [filter dictionary](#filter-operations). 3. Raise an HTTP exception if access is denied. @@ -285,7 +285,7 @@ async def on_assistant_create( ) ``` -Notice that we are mixing global and resource-specific handlers in the above example. Since each request is handled by the most specific handler, a request to create a `thread` would match the `on_thread_create` handler but NOT the `reject_unhandled_requests` handler. A request to `update` a thread, however would be handled by the global handler, since we don't have a more specific handler for that resource and action. Requests to create, update, +Notice that we are mixing global and resource-specific handlers in the above example. Since each request is handled by the most specific handler, a request to create a `thread` would match the `on_thread_create` handler but NOT the `reject_unhandled_requests` handler. A request to `update` a thread, however would be handled by the global handler, since we don't have a more specific handler for that resource and action. ### Filter Operations {#filter-operations}