You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/26 18:45:16 UTC
[GitHub] [airflow] potiuk opened a new pull request, #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
potiuk opened a new pull request, #25318:
URL: https://github.com/apache/airflow/pull/25318
The Google openid auth backend of ours had hard-coded way of
seting the current user which was not compatible with Flask 2.2
With Flask-login 0.6.2 the user is stored in g module of flask, where
before, it was stored in _request_ctx_stack. Unforatunately the
google_openid rather than using _update_request_context_with_user
set the user directly in context. In Flask-login 0.6.2 this stopped
working.
This change switches to use the _update_request_context_with_user
method rather than directly storing user in context which works before
and after the Flask-Login 0.6.2 change.
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.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+Improvements+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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on pull request #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
Posted by GitBox <gi...@apache.org>.
mik-laj commented on PR #25318:
URL: https://github.com/apache/airflow/pull/25318#issuecomment-1195939213
I am looking at it now, but I need to refresh the Breeze first.
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on pull request #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #25318:
URL: https://github.com/apache/airflow/pull/25318#issuecomment-1195885404
@mik-laj - question - i see that you were the original author of the openid integration here. Is this something to be used also beyond the scope of the experimental API ? Is this something that can be used in the new REST API as well (I am trying to understand the extent of the problem and see if this is something we should warn the users against).
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on pull request #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
Posted by GitBox <gi...@apache.org>.
mik-laj commented on PR #25318:
URL: https://github.com/apache/airflow/pull/25318#issuecomment-1196021637
<img width="1440" alt="Screenshot 2022-07-26 at 23 38 42" src="https://user-images.githubusercontent.com/12058428/181119317-ba156042-87d2-467d-b8dc-a1f53dd5dda9.png">
Tested and it works with V1 API.
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] mik-laj commented on pull request #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
Posted by GitBox <gi...@apache.org>.
mik-laj commented on PR #25318:
URL: https://github.com/apache/airflow/pull/25318#issuecomment-1200259659
To use this backend with v1 API, i executed the following commands:
```shell
export AIRFLOW__LOGGING__LOGGING_LEVEL="DEBUG"
export AIRFLOW__API__AUTH_BACKENDS="airflow.providers.google.common.auth_backend.google_openid"
export AIRFLOW__API__GOOGLE_OAUTH2_AUDIENCE="project-id-random-value.apps.googleusercontent.com"
```
```shell
gcloud auth activate-service-account --key-file /files/data-archive-303923-85ecb6d96736.json
airflow users create --email test-airflow-openid@data-archive-303923.iam.gserviceaccount.com -f 1 -l 2 -r Admin -u u
ENDPOINT_URL="http://localhost:8080/"
export AIRFLOW__API__GOOGLE_OAUTH2_AUDIENCE=project-id-random-value.apps.googleusercontent.com
AUDIENCE=$AIRFLOW__API__GOOGLE_OAUTH2_AUDIENCE
ID_TOKEN="$(gcloud auth print-identity-token "--audiences=${AUDIENCE}")"
curl -X GET \
"${ENDPOINT_URL}/api/v1/pools" \
-H 'Content-Type: application/json' \
-H 'Cache-Control: no-cache' \
-H "Authorization: Bearer ${ID_TOKEN}"
```
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk merged pull request #25318: Fix Flask Login user setting for Flask 2.2 and Flask-Login 0.6.2
Posted by GitBox <gi...@apache.org>.
potiuk merged PR #25318:
URL: https://github.com/apache/airflow/pull/25318
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org