jedcunningham commented on code in PR #45009:
URL: https://github.com/apache/airflow/pull/45009#discussion_r1889519920


##########
airflow/api_connexion/security.py:
##########
@@ -32,8 +32,8 @@
     PoolDetails,
     VariableDetails,
 )
+from airflow.providers.fab.www.extensions.init_auth_manager import 
get_auth_manager

Review Comment:
   Hmm, why do we need 2 get_auth_managers? Seems like the fab auth manager 
also needs to be used in fastapi, if that's the auth manager that was 
configured. Are there differences in the way its used by fastapi and fab that 
necessitates a fastapi-fab-auth-manager and a fab-fab-auth-manager?
   
   I realize the fab auth manager might have to get a little creative, since it 
doesn't really make sense for the auth manager interface to take an appbuilder 
any longer... but I imagine that is something we can work through.



##########
providers/src/airflow/providers/fab/auth_manager/fab_auth_manager.py:
##########
@@ -166,13 +169,36 @@ def get_cli_commands() -> list[CLICommand]:
             commands.append(GroupCommand(name="fab-db", help="Manage FAB", 
subcommands=DB_COMMANDS))
         return commands
 
+    def get_fastapi_app(self) -> FastAPI | None:
+        flask_blueprint = self.get_api_endpoints()
+
+        if not flask_blueprint:
+            return None
+
+        flask_app = create_app()
+        flask_app.register_blueprint(flask_blueprint)
+
+        app = FastAPI(
+            title="FAB auth manager API",
+            description=(
+                "This is FAB auth manager API. This API is only available if 
the auth manager used in "
+                "the Airflow environment is FAB auth manager. "
+                "This API provides endpoints to manager users and permissions 
managed by the FAB auth "
+                "manager."
+            ),
+        )
+        app.mount("/", WSGIMiddleware(flask_app))
+
+        return app
+
     def get_api_endpoints(self) -> None | Blueprint:

Review Comment:
   By "Airflow 2 legacy UI", do you mean when everything but the stuff for 
auth/plugins is gone, or completely gone?



-- 
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]

Reply via email to