Fix Keycloak double-slash URL bug (#61121)#61305
Merged
vincbeck merged 2 commits intoapache:mainfrom Feb 2, 2026
Merged
Conversation
Contributor
SameerMesiah97
left a comment
There was a problem hiding this comment.
Just one nit. Otherwise looks good. Safe change with solid test matrix.
providers/keycloak/src/airflow/providers/keycloak/auth_manager/keycloak_auth_manager.py
Show resolved
Hide resolved
- Normalize server_url in _get_token_url to prevent double-slashes
- Add .rstrip('/') to handle trailing slashes in server_url configuration
- Add comprehensive tests for URL normalization scenarios
- Resolves compatibility issue with Keycloak 26.4+ strict path validation
When server_url has a trailing slash (e.g., 'https://host/auth/'),
the previous implementation would create invalid URLs with double-slashes
(e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects
with HTTP 400 'missingNormalization' error.
This fix allows users to configure server_url with or without trailing
slashes while ensuring properly normalized URLs are always generated.
Fixes apache#61121
f259fbc to
dfcb9f6
Compare
vincbeck
reviewed
Feb 2, 2026
providers/keycloak/tests/unit/keycloak/auth_manager/test_keycloak_auth_manager.py
Outdated
Show resolved
Hide resolved
- Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
vincbeck
approved these changes
Feb 2, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
jason810496
pushed a commit
to abhijeets25012-tech/airflow
that referenced
this pull request
Feb 3, 2026
* Fix Keycloak double-slash URL bug (apache#61121) - Normalize server_url in _get_token_url to prevent double-slashes - Add .rstrip('/') to handle trailing slashes in server_url configuration - Add comprehensive tests for URL normalization scenarios - Resolves compatibility issue with Keycloak 26.4+ strict path validation When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error. This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated. Fixes apache#61121 * Refactor URL normalization tests to use parametrize - Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
Alok-kumar-priyadarshi
pushed a commit
to Alok-kumar-priyadarshi/airflow
that referenced
this pull request
Feb 5, 2026
* Fix Keycloak double-slash URL bug (apache#61121) - Normalize server_url in _get_token_url to prevent double-slashes - Add .rstrip('/') to handle trailing slashes in server_url configuration - Add comprehensive tests for URL normalization scenarios - Resolves compatibility issue with Keycloak 26.4+ strict path validation When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error. This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated. Fixes apache#61121 * Refactor URL normalization tests to use parametrize - Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
jhgoebbert
pushed a commit
to jhgoebbert/airflow_Owen-CH-Leung
that referenced
this pull request
Feb 8, 2026
* Fix Keycloak double-slash URL bug (apache#61121) - Normalize server_url in _get_token_url to prevent double-slashes - Add .rstrip('/') to handle trailing slashes in server_url configuration - Add comprehensive tests for URL normalization scenarios - Resolves compatibility issue with Keycloak 26.4+ strict path validation When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error. This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated. Fixes apache#61121 * Refactor URL normalization tests to use parametrize - Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
81 tasks
Ratasa143
pushed a commit
to Ratasa143/airflow
that referenced
this pull request
Feb 15, 2026
* Fix Keycloak double-slash URL bug (apache#61121) - Normalize server_url in _get_token_url to prevent double-slashes - Add .rstrip('/') to handle trailing slashes in server_url configuration - Add comprehensive tests for URL normalization scenarios - Resolves compatibility issue with Keycloak 26.4+ strict path validation When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error. This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated. Fixes apache#61121 * Refactor URL normalization tests to use parametrize - Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
choo121600
pushed a commit
to choo121600/airflow
that referenced
this pull request
Feb 22, 2026
* Fix Keycloak double-slash URL bug (apache#61121) - Normalize server_url in _get_token_url to prevent double-slashes - Add .rstrip('/') to handle trailing slashes in server_url configuration - Add comprehensive tests for URL normalization scenarios - Resolves compatibility issue with Keycloak 26.4+ strict path validation When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error. This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated. Fixes apache#61121 * Refactor URL normalization tests to use parametrize - Consolidate 4 separate test methods into a single parametrized test - Improves maintainability and reduces code duplication - Covers same scenarios: no trailing slash, single slash, multiple slashes, root path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #61121 - Fix KeycloakAuthManager double-slash URL construction when server_url has trailing slash
Description
When server_url has a trailing slash (e.g., 'https://host/auth/'), the previous implementation would create invalid URLs with double-slashes (e.g., 'https://host/auth//realms/...'), which Keycloak 26.4+ rejects with HTTP 400 'missingNormalization' error.
This fix allows users to configure server_url with or without trailing slashes while ensuring properly normalized URLs are always generated.
Changes
.rstrip('/')in_get_token_url()methodtest_get_token_url_without_trailing_slash- Baseline behaviortest_get_token_url_with_trailing_slash- Main bug scenariotest_get_token_url_with_multiple_trailing_slashes- Edge case handlingtest_get_token_url_with_root_path- Root URL scenarioTesting
Impact
Fixes #61121
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot