vincbeck commented on code in PR #47725:
URL: https://github.com/apache/airflow/pull/47725#discussion_r1993960269


##########
airflow/api_fastapi/core_api/routes/public/auth.py:
##########
@@ -40,3 +40,18 @@ def login(request: Request, next: None | str = None) -> 
RedirectResponse:
     if next:
         login_url += f"?next={next}"
     return RedirectResponse(login_url)
+
+
+@auth_router.get(
+    "/logout",
+    
responses=create_openapi_http_exception_doc([status.HTTP_307_TEMPORARY_REDIRECT]),
+)
+def logout(request: Request, next: None | str = None) -> RedirectResponse:
+    """Logout the user."""
+    logout_url = request.app.state.auth_manager.get_url_logout()
+
+    if logout_url:
+        return RedirectResponse(logout_url)
+
+    login_url = request.app.state.auth_manager.get_url_login()
+    return RedirectResponse(login_url)

Review Comment:
   nit
   
   ```suggestion
       if not logout_url:
           logout_url = request.app.state.auth_manager.get_url_login()
   
       return RedirectResponse(login_url)
   ```



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