bugraoz93 commented on code in PR #57992:
URL: https://github.com/apache/airflow/pull/57992#discussion_r2501303297
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/routes/login.py:
##########
@@ -80,16 +80,48 @@ def login_callback(request: Request):
return response
+@login_router.get("/logout")
+def logout(request: Request, user: Annotated[KeycloakAuthManagerUser,
Depends(get_user)]):
+ """Log out the user from Keycloak."""
+ client = KeycloakAuthManager.get_keycloak_client()
+ keycloak_config = client.well_known()
+ end_session_endpoint = keycloak_config["end_session_endpoint"]
+
+ # Use the refresh flow to get the id token, it avoids us to save the id
token
+ tokens = client.refresh_token(user.refresh_token)
+ # baseurl = conf.get("api", "base_url", fallback="/")
+ # post_logout_redirect_uri = urljoin(baseurl.rstrip("/"),
f"{AUTH_MANAGER_FASTAPI_APP_PREFIX}/logout_callback")
Review Comment:
```suggestion
```
--
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]