Skip to content

Revoke JWT token on provider-level /auth/logout routes - #70593

Open
securylight wants to merge 1 commit into
apache:mainfrom
securylight:keycloak-fab-logout-revoke-token
Open

Revoke JWT token on provider-level /auth/logout routes#70593
securylight wants to merge 1 commit into
apache:mainfrom
securylight:keycloak-fab-logout-revoke-token

Conversation

@securylight

Copy link
Copy Markdown

Core's /auth/logout (#67289) revokes the current JWT before redirecting to the auth manager's logout URL. FabAuthManager's and KeycloakAuthManager's own /auth/logout routes don't do the same before redirecting to the IdP, so a token stays valid if that route is reached directly. This adds the same revoke_token() call to both, for consistency.

Test plan

  • Added test_logout_revokes_token / test_logout_without_token_cookie_does_not_revoke for both providers
  • Existing logout tests still pass

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Sonnet 5)

Generated-by: Claude Code (Sonnet 5) following the guidelines

The core /auth/logout route (core_api/routes/public/auth.py) revokes
the current JWT before redirecting to the auth manager's logout URL
(see apache#67289). FabAuthManager's and KeycloakAuthManager's own
provider-level /auth/logout routes redirect straight to the IdP
without the same revocation call, so a token is still valid if that
route is reached directly instead of through the core route.

This adds the same revoke_token() call to both provider routes for
consistency, so a JWT is revoked regardless of which /auth/logout
path handles the request.
@boring-cyborg

boring-cyborg Bot commented Jul 28, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done even if the auth manager has its custom logout route. Why doing it twice? https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/routes/public/auth.py#L65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants