stephen-bracken commented on code in PR #70707:
URL: https://github.com/apache/airflow/pull/70707#discussion_r4612241966


##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/middleware.py:
##########
@@ -52,263 +59,235 @@ def get_cookie_path() -> str:
         return "/"
 
 
-# The core route that revokes the Airflow JWT sent with the request, relative 
to the root path.
-LOGOUT_PATH = "/api/v2/auth/logout"
+if AIRFLOW_V_3_4_PLUS:
+    from airflow.api_fastapi.auth.middlewares.refresh_token import 
UNAUTHENTICATED_PATHS
+else:
+    # Unauthenticated endpoints that never read the user, so resolving it 
there would only cost a
+    # JWT decode and a revocation lookup on every health check and UI boot.
+    UNAUTHENTICATED_PATHS = frozenset(["/api/v2/monitor/health", 
"/api/v2/version"])
 
 if TYPE_CHECKING:
-    from fastapi import Request, Response
+    from starlette.types import ASGIApp, Message, Receive, Scope, Send
 
-    from airflow.providers.keycloak.auth_manager.keycloak_auth_manager import 
KeycloakAuthManager
+    from airflow.api_fastapi.auth.managers.models.base_user import BaseUser
     from airflow.providers.keycloak.auth_manager.user import 
KeycloakAuthManagerUser
 
+if AIRFLOW_V_3_4_1_PLUS:

Review Comment:
   `request_cookie_is_secure` was added in 3.4.1, so this type guard is 
separate to `_middleware_handles_cookies()`



-- 
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