pierrejeambrun commented on code in PR #48417:
URL: https://github.com/apache/airflow/pull/48417#discussion_r2017115181


##########
airflow-core/docs/core-concepts/auth-manager/index.rst:
##########
@@ -147,6 +129,29 @@ These authorization methods are:
 * ``is_authorized_view``: Return whether the user is authorized to access a 
specific view in Airflow. The view is specified through ``access_view`` (e.g. 
``AccessView.CLUSTER_ACTIVITY``).
 * ``is_authorized_custom_view``: Return whether the user is authorized to 
access a specific view not defined in Airflow. This view can be provided by the 
auth manager itself or a plugin defined by the user.
 
+JWT token management by auth managers
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The auth manager is responsible of creating the JWT token needed to interact 
with Airflow public API.
+To achieve this, the auth manager **must** provide an endpoint to create this 
JWT token. This endpoint must be
+available at ``POST /auth/token``
+
+The auth manager is also responsible of passing the JWT token to Airflow UI. 
The protocol to exchange the JWT
+token between the auth manager and Airflow UI is using cookies. The auth 
manager needs to save the JWT token in a
+cookie named ``_token`` before redirecting to the Airflow UI. The Airflow UI 
will then read the cookie, save it and
+delete the cookie.
+
+.. code-block:: python
+
+    from airflow.api_fastapi.auth.managers.base_auth_manager import 
COOKIE_NAME_JWT_TOKEN
+
+    response = RedirectResponse(url="/")
+    response.set_cookie(COOKIE_NAME_JWT_TOKEN, token, secure=True)
+    return response
+
+.. note::
+    Do not set the cookie parameter ``httponly`` to ``True``. Airflow UI needs 
to access the JWT token from the cookie.

Review Comment:
   https://github.com/apache/airflow/pull/48453



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to