-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up JWT token authentication in Fast APIs #42634
Conversation
I think we want to deprecate and then remove the session auth backend? |
e7b4bcd
to
d5504fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice 👍 This is what I had in mind I think it's worth continuing efforts on that. Thanks Vincent for this work :)
(There's a small formatting indent space thing for generated files, but that's not important at this point)
I would say yes. The front end uses Yes public API can specify additional backends if needed by the user. (But the front-end is always using the JWT one). This will be for custom front-end or API calls made by other clients that desieres an other authentication schema. To summarize my idea:
If that's too much work, we can at first only support JWT Oauth for the new API (both public and UI). And add more backends in 3.x. I don't know how critical it is to have that in the initial airflow 3 release. |
1b4788d
to
9a4ba3c
Compare
a0a9b11
to
66c87ef
Compare
@ashb @potiuk Question for you. Since we want to create a new major version of FAB provider that would only be compatible with Airflow 3, I do not need to work on the compat tests failures right? They are failing because I introduced some breaking changes in the auth manager interface so the FAB auth manager is no longer compatible with the auth manager interface from Airflow 2.X |
Ready for review @pierrejeambrun |
66c87ef
to
dda6676
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks
dda6676
to
0b9f423
Compare
I have been trying and experimenting to support auth backends in the public API in FastApi and I am still unsure it is possible to support them in FastApi. If we go that direction we would have to create an API to create a token. Here is an example of flow:
|
Yes, we can use a flask server as our airflow It will also be useful at first to still have a flask server somewhere for old plugins backward compatibility. |
80030bb
to
f03d018
Compare
f03d018
to
9626d56
Compare
9626d56
to
b9a9e8a
Compare
Goal
Set-up authentication using JWT token in UI API. The UI API should be protected hy authentication using JWT token. This PR creates the logic behind JWT token authentication.
What is done?
What has been done but is not in this PR?
airflow/api_fastapi/views/public/dags.py
. I am aware this is the public API and not the UI API but this is just for testing.The reason why I did not include these changes in the PR is we need first the UI to pass down the token to the API. Otherwise all APIs will fail. I'll create follow-up PRs once the new UI handle the token.
What is not done?
The actual JWT auth-backend. This can be done in a separate PR once this one is merged so for the sake of keeping a PR as small as possible, I'll do it in a separate PR
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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.