Skip to content

Move keycloak JWT tokens to separate cookies - #70550

Merged
vincbeck merged 1 commit into
apache:mainfrom
stephen-bracken:keycloak-separate-cookie
Jul 29, 2026
Merged

Move keycloak JWT tokens to separate cookies#70550
vincbeck merged 1 commit into
apache:mainfrom
stephen-bracken:keycloak-separate-cookie

Conversation

@stephen-bracken

@stephen-bracken stephen-bracken commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Move Keycloak JWT tokens out of Airflow JWT

closes: #61771

The Keycloak access_token and refresh_token fields of the Airflow JWT make the cookie set in the browser very large. Most browsers use a cookie size limit of 4096 bytes by default, so with a modest number of claims on the Keycloak JWTs the Airflow JWT will easily fill this limit. If we convert the KeycloakAuthManagerUser into a pydantic model, FastAPI can automatically insert the values of cookies into the appropriate fields when the user is being requested.

https://fastapi.tiangolo.com/tutorial/cookie-param-models/#cookies-with-a-pydantic-model

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
  • No

@stephen-bracken
stephen-bracken force-pushed the keycloak-separate-cookie branch 13 times, most recently from c5e74e5 to 459a2cc Compare July 29, 2026 10:58
@stephen-bracken
stephen-bracken marked this pull request as ready for review July 29, 2026 10:58
@stephen-bracken
stephen-bracken force-pushed the keycloak-separate-cookie branch 2 times, most recently from cd87392 to c4a7a8d Compare July 29, 2026 12:42
@vincbeck vincbeck changed the title move keycloak JWT tokens to separate cookies Move keycloak JWT tokens to separate cookies Jul 29, 2026

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

Code looks pretty solid!

@stephen-bracken
stephen-bracken force-pushed the keycloak-separate-cookie branch 2 times, most recently from 664b0f5 to f709188 Compare July 29, 2026 13:29
@stephen-bracken
stephen-bracken force-pushed the keycloak-separate-cookie branch from f709188 to e82a163 Compare July 29, 2026 14:18
@vincbeck
vincbeck merged commit 0cdb8cc into apache:main Jul 29, 2026
79 checks passed
@stephen-bracken

Copy link
Copy Markdown
Contributor Author

@vincbeck I need to do a followup PR on this, I don't think the cookie is being retrieved correctly here unfortunately

@vincbeck

Copy link
Copy Markdown
Contributor

Please do. Please also do some testing before, that would avoid this kind of situation

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.

Keycloak provider login fails if access token is too large because of cookie size limit

2 participants