Skip to content

Override JWTRefreshMiddleware in KeycloakAuthManager to handle Keycloak JWT Cookies - #70707

Draft
stephen-bracken wants to merge 6 commits into
apache:mainfrom
stephen-bracken:pass-request
Draft

Override JWTRefreshMiddleware in KeycloakAuthManager to handle Keycloak JWT Cookies#70707
stephen-bracken wants to merge 6 commits into
apache:mainfrom
stephen-bracken:pass-request

Conversation

@stephen-bracken

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

Copy link
Copy Markdown
Contributor

related: #70550

Get Keycloak JWT from request cookies in get_user_from_token

  1. Move the JWTRefreshMiddleware initialisation to BaseAuthManager.get_fastapi_middlewares() to make it overrideable
  2. Add a new KeycloakJWTRefreshMiddleware middleware that extends the JWTRefreshMiddleware by getting and setting the Keycloak JWTs for the user from the cookies
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
  • No

@stephen-bracken stephen-bracken changed the title Resolve Keycloak tokens from request cookies in get_user_from_token() Resolve Keycloak tokens from request cookies in KeycloakAuthManager.get_user_from_token(), add request object to resolve_user_from_token() Jul 29, 2026
@stephen-bracken
stephen-bracken force-pushed the pass-request branch 4 times, most recently from 1c0cc45 to 1a9cf0d Compare July 29, 2026 23:38
@stephen-bracken
stephen-bracken force-pushed the pass-request branch 3 times, most recently from bf78928 to 3669a91 Compare July 30, 2026 10:15
@stephen-bracken stephen-bracken changed the title Resolve Keycloak tokens from request cookies in KeycloakAuthManager.get_user_from_token(), add request object to resolve_user_from_token() Override JWTRefreshMiddleware in KeycloakAuthManager to handle Keycloak JWT Cookies Jul 30, 2026
@stephen-bracken
stephen-bracken force-pushed the pass-request branch 4 times, most recently from d225f24 to bf8b4ff Compare July 31, 2026 14:56
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.

1 participant