pierrejeambrun commented on code in PR #42019:
URL: https://github.com/apache/airflow/pull/42019#discussion_r1746652987
##########
airflow/api_ui/app.py:
##########
@@ -32,17 +38,35 @@ def init_dag_bag(app: FastAPI) -> None:
app.state.dag_bag = get_dag_bag()
-def create_app() -> FastAPI:
+def init_flask_app(app: FastAPI, testing: bool = False) -> None:
+ """
+ Auth providers and permission logic are tightly coupled to Flask.
Review Comment:
```
The only dependency on FAB that the auth managers have now is the way to
register custom views. It is currently using appbuilder, this is something we
want to get rid of. This will go away when AIP-68 is complete and there will be
a way for plugins to extend new Airflow UI. But besides that, simple auth
manager do not depend on FAB
```
Can you elaborate how this could work outside of a `flask request context`
and `flask app context` like here in a FastAPI app ? In its current
implementation, the `SimpleAuthManager` is using the flask `session` object to
check if the user `is_logged_in` or to retrieve the current user via
`get_user`. Accessing the flask `session` object is not possible in FastAPI, we
do not have such context available at runtime. So basically i'm not sure how I
can use that in our new `api_ui` code ? Calling those method will yield a
runtime like this one `RuntimeError: Working outside of application context`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]