vincbeck commented on PR #36052: URL: https://github.com/apache/airflow/pull/36052#issuecomment-1898786641
> > > Update init_api_auth_provider function. > > > In get_api_endpoints function we use connexion_app.add_api and expect FlaskApi as a return object, but add_api function always return None. Previously we use FlaskApi object for taking blueprints and then extend our base_paths here: https://github.com/apache/airflow/pull/36052/files#diff-a1cf5a1eea3231a292d789d82df7943bfe8fa89ca955404b2f9cdaa25e08fa80R309 > > > @vincbeck is it important to save this logic for fab_auth_manager or is it enough to register blueprints under connexion_app.add_api functionality? > > > > > > I am not sure this is relevant anymore. The signature of `get_api_endpoints` changed. See [here](https://github.com/apache/airflow/blob/main/airflow/providers/fab/auth_manager/fab_auth_manager.py#L149). It should simplify the problem. > > Hi @vincbeck ! I think the question here was about the line where we are appending `base_paths` variable with new registered blueprint. With the new version of Connexion the way of registering blueprints will be changed to register in connexion_app. So the method `get_api_endpoints()` with new version of Connexion will return None instead of blueprint object. So, if we can't return blueprint from the `get_api_endpoints()` method, the `base_paths` variable couldn't be extended. Should we consider still updating `base_paths` with blueprint object? Is this variable used later somewhere? The if statement here shows that we still can continue without adding blueprint to this list of base_paths. If we need this variable later, is there other way to add blueprint not using value returned by `get_api_endpoints()` since now it will return None? > > ``` > def init_api_auth_provider(connexion_app: connexion.FlaskApp): > """Initialize the API offered by the auth manager.""" > auth_mgr = get_auth_manager() > blueprint = auth_mgr.get_api_endpoints(connexion_app) > if blueprint: > base_paths.append(blueprint.url_prefix if blueprint.url_prefix else "") > flask_app = connexion_app.app > flask_app.extensions["csrf"].exempt(blueprint) > ``` I think the way we should do it is really close to what you have now with few differences: - Rename `get_api_endpoints` to `set_api_endpoints`. The return type should be updated to `None`. Documentation should be updated as well to something like "Set API endpoint(s) definition for the auth manager.". This is a breaking change but nobody uses this interface yet, so it is a good time to do it. - This piece of code `flask_app.extensions["csrf"].exempt(blueprint)` should be moved in the `set_api_endpoints` method using `appbuilder.app.extensions["csrf"].exempt(api.blueprint)` -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org