Commit 0cf2026
authored
* Fix Keycloak double-slash URL bug (#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 #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
1 parent 784e1a9 commit 0cf2026
File tree
2 files changed
+28
-1
lines changed- providers/keycloak
- src/airflow/providers/keycloak/auth_manager
- tests/unit/keycloak/auth_manager
2 files changed
+28
-1
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
| 416 | + | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
0 commit comments