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


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/auth.py:
##########
@@ -57,11 +64,21 @@ def login(request: Request, auth_manager: AuthManagerDep, 
next: None | str = Non
     "/logout",
     
responses=create_openapi_http_exception_doc([status.HTTP_307_TEMPORARY_REDIRECT]),
 )
-def logout(request: Request, auth_manager: AuthManagerDep) -> RedirectResponse:
+def logout(
+    request: Request,
+    auth_manager: AuthManagerDep,
+    oauth_token: str | None = Depends(oauth2_scheme),
+    bearer_credentials: HTTPAuthorizationCredentials | None = 
Depends(bearer_scheme),
+) -> RedirectResponse:
     """Logout the user."""
-    # Revoke the current token before any redirect or cookie deletion so the 
JWT
-    # is invalidated even when the auth manager redirects to an external 
logout URL.
-    if token_str := request.cookies.get(COOKIE_NAME_JWT_TOKEN):
+    # Revoke every credential presented before any redirect or cookie 
deletion, so the
+    # JWT is invalidated even when the auth manager redirects to an external 
logout URL.
+    #
+    # This previously read only the `_token` cookie. A client that 
authenticates with an
+    # `Authorization: Bearer` header -- the documented way to call the API -- 
therefore
+    # got a successful logout response while its token was never revoked, and 
the token
+    # stayed valid until it expired.

Review Comment:
   I'll do that in the follow up PR. too 
   



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