This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new a06032e0f8e Update simple auth manager documentation to include token 
API (#48454)
a06032e0f8e is described below

commit a06032e0f8e3e8501feb5b751735c93ba0d08ad0
Author: Vincent <[email protected]>
AuthorDate: Fri Mar 28 08:59:17 2025 -0400

    Update simple auth manager documentation to include token API (#48454)
---
 .../docs/core-concepts/auth-manager/index.rst      | 10 +++---
 .../auth-manager/{simple.rst => simple/index.rst}  |  7 ++++
 .../auth-manager/simple/sam-token-api-ref.rst      | 23 ++++++++++++
 .../core-concepts/auth-manager/simple}/token.rst   | 19 ++++++----
 docs/conf.py                                       | 41 +++++++++++++---------
 providers/fab/docs/auth-manager/token.rst          | 10 +++---
 6 files changed, 78 insertions(+), 32 deletions(-)

diff --git a/airflow-core/docs/core-concepts/auth-manager/index.rst 
b/airflow-core/docs/core-concepts/auth-manager/index.rst
index 2826dda0a67..417bad407db 100644
--- a/airflow-core/docs/core-concepts/auth-manager/index.rst
+++ b/airflow-core/docs/core-concepts/auth-manager/index.rst
@@ -37,6 +37,11 @@ If you want to check which auth manager is currently set, 
you can use the
     $ airflow config get-value core auth_manager
     airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
 
+.. toctree::
+    :hidden:
+
+    simple/index
+
 Available auth managers to use
 ------------------------------
 
@@ -44,10 +49,7 @@ Here is the list of auth managers available today that you 
can use in your Airfl
 
 Provided by Airflow:
 
-.. toctree::
-    :maxdepth: 1
-
-    simple
+* :doc:`simple/index`
 
 Provided by providers:
 
diff --git a/airflow-core/docs/core-concepts/auth-manager/simple.rst 
b/airflow-core/docs/core-concepts/auth-manager/simple/index.rst
similarity index 98%
rename from airflow-core/docs/core-concepts/auth-manager/simple.rst
rename to airflow-core/docs/core-concepts/auth-manager/simple/index.rst
index 507c14d62d6..edc8fdd1a56 100644
--- a/airflow-core/docs/core-concepts/auth-manager/simple.rst
+++ b/airflow-core/docs/core-concepts/auth-manager/simple/index.rst
@@ -25,6 +25,13 @@ Simple auth manager
 The simple auth manager is the auth manager that comes by default in Airflow 
3. As its name suggests,
 the logic and implementation of the simple auth manager is **simple**.
 
+.. toctree::
+    :maxdepth: 1
+
+    token
+    sam-token-api-ref
+
+
 Manage users
 ------------
 
diff --git 
a/airflow-core/docs/core-concepts/auth-manager/simple/sam-token-api-ref.rst 
b/airflow-core/docs/core-concepts/auth-manager/simple/sam-token-api-ref.rst
new file mode 100644
index 00000000000..02fd335086d
--- /dev/null
+++ b/airflow-core/docs/core-concepts/auth-manager/simple/sam-token-api-ref.rst
@@ -0,0 +1,23 @@
+
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+Simple auth manager token API
+=============================
+
+It's a stub file. It will be converted automatically during the build process
+to the valid documentation by the Sphinx plugin. See: /docs/conf.py
diff --git a/providers/fab/docs/auth-manager/token.rst 
b/airflow-core/docs/core-concepts/auth-manager/simple/token.rst
similarity index 67%
copy from providers/fab/docs/auth-manager/token.rst
copy to airflow-core/docs/core-concepts/auth-manager/simple/token.rst
index 9d5f397665a..4e9e5cadf32 100644
--- a/providers/fab/docs/auth-manager/token.rst
+++ b/airflow-core/docs/core-concepts/auth-manager/simple/token.rst
@@ -15,15 +15,15 @@
     specific language governing permissions and limitations
     under the License.
 
-Generate JWT token for Airflow public API
-=========================================
+Generate JWT token with simple auth manager
+===========================================
 
 .. note::
-    This guide only applies if your environment is configured with FAB auth 
manager.
+    This guide only applies if your environment is configured with simple auth 
manager.
 
-In order to use the :doc:`Airflow public API 
<apache-airflow:stable-rest-api-ref>`, you need a JWT token to authenticate 
yourself.
-Then you can use this token in the Airflow public API request to access it.
-To generate a JWT token, you need to use the API ``Create Token`` in 
:doc:`/api-ref/fab-token-api-ref`.
+In order to use the :doc:`Airflow public API </stable-rest-api-ref>`, you need 
a JWT token for authentication.
+You can then include this token in your Airflow public API requests.
+To generate a JWT token, use the ``Create Token`` API in 
:doc:`sam-token-api-ref`.
 
 Example
 '''''''
@@ -40,3 +40,10 @@ Example
         }'
 
 This process will return a token that you can use in the Airflow public API 
requests.
+
+If ``[core] simple_auth_manager_all_admins`` is set to True, you can also 
generate a token with no credentials.
+
+.. code-block:: bash
+
+    ENDPOINT_URL="http://localhost:8080/";
+    curl -X 'GET' "${ENDPOINT_URL}/auth/token"
diff --git a/docs/conf.py b/docs/conf.py
index 6b3fc7d54d6..b5c6ba76702 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -903,38 +903,45 @@ if PACKAGE_NAME in packages_with_redoc:
     redoc_script_url = 
"https://cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.js";
 
 if PACKAGE_NAME == "apache-airflow":
-    OPENAPI_FILE = (
-        Path(__file__).parents[1]
-        / "airflow-core"
-        / "src"
-        / "airflow"
-        / "api_fastapi"
-        / "core_api"
-        / "openapi"
-        / "v1-generated.yaml"
-    )
+    from airflow.api_fastapi.auth.managers.simple.openapi import __file__ as 
sam_openapi_file
+    from airflow.api_fastapi.core_api.openapi import __file__ as 
main_openapi_file
+
+    main_openapi_path = 
Path(main_openapi_file).parent.joinpath("v1-generated.yaml")
+    sam_openapi_path = 
Path(sam_openapi_file).parent.joinpath("v1-generated.yaml")
     redoc = [
         {
             "name": "Airflow REST API",
             "page": "stable-rest-api-ref",
-            "spec": OPENAPI_FILE.as_posix(),
+            "spec": main_openapi_path.as_posix(),
+            "opts": {
+                "hide-hostname": True,
+                "no-auto-auth": True,
+            },
+        },
+        {
+            "name": "Simple auth manager token API",
+            "page": "core-concepts/auth-manager/simple/sam-token-api-ref",
+            "spec": sam_openapi_path.as_posix(),
             "opts": {
                 "hide-hostname": True,
             },
         },
     ]
 elif PACKAGE_NAME == "apache-airflow-providers-fab":
-    from airflow.providers.fab.auth_manager import __file__ as 
auth_manager_path
+    from airflow.providers.fab.auth_manager.api_fastapi.openapi import (
+        __file__ as fab_auth_manager_fastapi_api_file,
+    )
+    from airflow.providers.fab.auth_manager.openapi import __file__ as 
fab_auth_manager_flask_api_file
 
-    fab_flask_openapi_file = 
Path(auth_manager_path).parent.joinpath("openapi", "v1.yaml")
-    fab_fastapi_openapi_file = Path(auth_manager_path).parent.joinpath(
-        "api_fastapi", "openapi", "v1-generated.yaml"
+    fab_auth_manager_flask_api_path = 
Path(fab_auth_manager_flask_api_file).parent.joinpath("v1.yaml")
+    fab_auth_manager_fastapi_api_path = 
Path(fab_auth_manager_fastapi_api_file).parent.joinpath(
+        "v1-generated.yaml"
     )
     redoc = [
         {
             "name": "Fab auth manager API",
             "page": "api-ref/fab-public-api-ref",
-            "spec": fab_flask_openapi_file.as_posix(),
+            "spec": fab_auth_manager_flask_api_path.as_posix(),
             "opts": {
                 "hide-hostname": True,
                 "no-auto-auth": True,
@@ -943,7 +950,7 @@ elif PACKAGE_NAME == "apache-airflow-providers-fab":
         {
             "name": "Fab auth manager token API",
             "page": "api-ref/fab-token-api-ref",
-            "spec": fab_fastapi_openapi_file.as_posix(),
+            "spec": fab_auth_manager_fastapi_api_path.as_posix(),
             "opts": {
                 "hide-hostname": True,
                 "no-auto-auth": True,
diff --git a/providers/fab/docs/auth-manager/token.rst 
b/providers/fab/docs/auth-manager/token.rst
index 9d5f397665a..35c9bb3a74a 100644
--- a/providers/fab/docs/auth-manager/token.rst
+++ b/providers/fab/docs/auth-manager/token.rst
@@ -15,15 +15,15 @@
     specific language governing permissions and limitations
     under the License.
 
-Generate JWT token for Airflow public API
-=========================================
+Generate JWT token with FAB auth manager
+========================================
 
 .. note::
     This guide only applies if your environment is configured with FAB auth 
manager.
 
-In order to use the :doc:`Airflow public API 
<apache-airflow:stable-rest-api-ref>`, you need a JWT token to authenticate 
yourself.
-Then you can use this token in the Airflow public API request to access it.
-To generate a JWT token, you need to use the API ``Create Token`` in 
:doc:`/api-ref/fab-token-api-ref`.
+In order to use the :doc:`Airflow public API 
<apache-airflow:stable-rest-api-ref>`, you need a JWT token for authentication.
+You can then include this token in your Airflow public API requests.
+To generate a JWT token, use the ``Create Token`` API in 
:doc:`/api-ref/fab-token-api-ref`.
 
 Example
 '''''''

Reply via email to