Re: [PR] Make FAB auth manager login process compatible with Airflow 3 UI [airflow]
vincbeck merged PR #45765: URL: https://github.com/apache/airflow/pull/45765 -- 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]
Re: [PR] Make FAB auth manager login process compatible with Airflow 3 UI [airflow]
vincbeck commented on code in PR #45765:
URL: https://github.com/apache/airflow/pull/45765#discussion_r1922817575
##
providers/src/airflow/providers/fab/www/extensions/init_appbuilder.py:
##
@@ -500,7 +512,11 @@ def add_view_no_menu(self, baseview, endpoint=None,
static_folder=None):
@property
def get_url_for_index(self):
-# TODO: Return the fast api application homepage
+if not self.enable_plugins and g.user is not None and
g.user.is_authenticated:
+# If plugins are disabled and the user is authenticated, it should
be redirected to the Airflow 3 UI index page along with the JWT token
+token = get_auth_manager().get_jwt_token(g.user)
+return f"https://localhost:29091/webapp?token={token}";
Review Comment:
I found a solution without creating a config
--
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]
Re: [PR] Make FAB auth manager login process compatible with Airflow 3 UI [airflow]
pierrejeambrun commented on code in PR #45765:
URL: https://github.com/apache/airflow/pull/45765#discussion_r1922441883
##
providers/src/airflow/providers/fab/www/extensions/init_appbuilder.py:
##
@@ -500,7 +512,11 @@ def add_view_no_menu(self, baseview, endpoint=None,
static_folder=None):
@property
def get_url_for_index(self):
-# TODO: Return the fast api application homepage
+if not self.enable_plugins and g.user is not None and
g.user.is_authenticated:
+# If plugins are disabled and the user is authenticated, it should
be redirected to the Airflow 3 UI index page along with the JWT token
+token = get_auth_manager().get_jwt_token(g.user)
+return f"https://localhost:29091/webapp?token={token}";
Review Comment:
Yes I think a config would be nice.
--
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]
Re: [PR] Make FAB auth manager login process compatible with Airflow 3 UI [airflow]
vincbeck commented on code in PR #45765:
URL: https://github.com/apache/airflow/pull/45765#discussion_r1920808886
##
providers/src/airflow/providers/fab/www/extensions/init_appbuilder.py:
##
@@ -500,7 +512,11 @@ def add_view_no_menu(self, baseview, endpoint=None,
static_folder=None):
@property
def get_url_for_index(self):
-# TODO: Return the fast api application homepage
+if not self.enable_plugins and g.user is not None and
g.user.is_authenticated:
+# If plugins are disabled and the user is authenticated, it should
be redirected to the Airflow 3 UI index page along with the JWT token
+token = get_auth_manager().get_jwt_token(g.user)
+return f"https://localhost:29091/webapp?token={token}";
Review Comment:
This is obviously not ideal. Should we create a config to store that value?
Important point: it MUST be an HTTPS endpoint, otherwise FLask wont make the
redirect
--
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]
[PR] Make FAB auth manager login process compatible with Airflow 3 UI [airflow]
vincbeck opened a new pull request, #45765:
URL: https://github.com/apache/airflow/pull/45765
The plan to support FAB auth manager in Airflow 3 is:
- Create a trimmed version of the Airflow 2 Flask application in FAB
provider. This is done ✅
- Embed this Flask application in fastapi application using `WSGIMiddleware`
when FAB auth manager is the auth manager configured in the Airflow
environment. This is done ✅
- Update the FAB provider Flask application login process to be compatible
with Airflow 3 UI. This is this PR
- Update `get_url_login` method in FAB auth manager to return the
appropriate login URL so that the fastapi application can retrieve this value
and pass it to the front-end. On the front-end, if the user is not
authenticated, it will redirect the user to this URL. It will be done in a
future PR.
### Testing
You can test this PR by going to `/auth/login`and enter
credentials. If you get successfully authenticated you'll be redirected to
Airflow 3 UI with a JWT token.
---
**^ Add meaningful description above**
Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information.
In case of fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a
newsfragment file, named `{pr_number}.significant.rst` or
`{issue_number}.significant.rst`, in
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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]
