feat: add FAB AuthManager override to safely skip session rotation fo…#59611
Closed
KH-Coder865 wants to merge 4 commits into
Closed
feat: add FAB AuthManager override to safely skip session rotation fo…#59611KH-Coder865 wants to merge 4 commits into
KH-Coder865 wants to merge 4 commits into
Conversation
…r token generation
|
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 (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
Contributor
|
I assumethis is fixed with (currently un-released) #59355 ? |
Contributor
|
I agree with @jscheffl . Closing it |
Author
|
Okay. Thanks for the confirmation. |
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.
Problem:
Currently, calling auth_user_oauth() outside a Flask request context triggers RuntimeError: Working outside request context. The only workaround is overriding the private _rotate_session_id method, which is not recommended.
Solution:
Add a rotate_session_id=False option to skip session rotation safely.
Implement TheOverrideFabAuthManager.create_token() that wraps the token creation in an application and request context.
This approach avoids touching private methods while enabling token generation for API clients or background processes.
Testing:
Verified token generation works without a request context.
Tested compatibility with Airflow API v2 calls.
Existing FAB authentication tests pass.
Notes:
No backwards-incompatible changes.
No new dependencies.
Closes / Related Issues:
Closes: #59600