-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Fix ApprovalOperator with SimpleAuthManager when all_admins=True #59399
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
base: main
Are you sure you want to change the base?
Conversation
Fixes apache#59348. Added is_allowed() method to BaseAuthManager and all implementations to properly delegate HITL permission checks. - SimpleAuthManager: Returns True when simple_auth_manager_all_admins=True - Other managers: Check if user is in assigned_users list - Updated hitl.py to use auth manager's is_allowed() method Remove duplicate import
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
jason810496
left a comment
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.
Nice! Thanks for the fix and it LGTM overall.
airflow-core/src/airflow/api_fastapi/auth/managers/base_auth_manager.py
Outdated
Show resolved
Hide resolved
providers/amazon/src/airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py
Outdated
Show resolved
Hide resolved
…onsistency and remove redundant code
jason810496
left a comment
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.
Thanks for the update!
Also that is a new functionality and some thinking on how we communicatee it (newsfragment) and what should be default behaviour for Auth Managers that do not implement it should be.
It would be nice to add the 59399.feature.rst newsfragment from airflow-core/newsfragments/template.significant.rst template.
Thanks!
airflow-core/src/airflow/api_fastapi/auth/managers/simple/simple_auth_manager.py
Outdated
Show resolved
Hide resolved
|
Thanks, will do after a long haul flight. |
airflow-core/src/airflow/api_fastapi/auth/managers/base_auth_manager.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/auth/managers/simple/simple_auth_manager.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/auth/managers/base_auth_manager.py
Outdated
Show resolved
Hide resolved
|
Some comments but the overall direction is good I think |
|
Please also update documentation to mention this new API in |
- Update method to use keyword-only parameters - Take full user object instead of just user_id - Add unit tests for BaseAuthManager and SimpleAuthManager - Update hitl.py call site to match new signature
Lee-W
left a comment
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.
overall looks good. But would like to confirm with @vincbeck whether it's possible to have more than one user with the same ID (I guess not?) if so, should we use id, name pair to check instead
Nope. you can't. User_id uniquely identifies user in AuthManager. |
|
Looks way better now :) |
af780b0 to
11af683
Compare
…ead to Internal Server Error in API server (apache#59382) * refactor: Fix logout route in Keycloak provider also so the KeycloakPostError doesn't propagate to API server also which leads to Internal Server Error * refactor: Fixed static checks * refactor: Fixed refresh_token invocations * refactor: Must call refresh_user in refresh route * refactor: refresh_token must always return a dict * refactor: Added test when keycloak client raises KeycloakPostError when refresh_token is being invoked in logout route * refactor: Fixed some additional static checks * refactor: Refactored refresh_user * refactor: Reformatted imports * refactor: Fixed mocking in refresh test * refactor: Removed unused mocking of keycloak client in test_refresh_token * refactor: Fixed mock get_auth_manager and added missing import KeycloakAuthManagerUser * refactor: Refresh token route calls refresh_user instead of refresh_token * refactor: Changed assert on refresh user * Update providers/keycloak/src/airflow/providers/keycloak/auth_manager/keycloak_auth_manager.py Co-authored-by: Vincent <[email protected]> * refactor: Fixed calls to refresh_tokens instead of refresh_token --------- Co-authored-by: Vincent <[email protected]>
…#59489) Co-authored-by: nhuan.bc <[email protected]>
…che#59493) This change is needed for compatibility (i.e. stop the test from failing) with the `SQLALCHEMY_ENGINE_DEBUG` flag.
…on (apache#41706) (apache#58841) * Fix AsyncKubernetesHook when Kubernetes connection is missing (apache#41706) * fix CI error * fix CI error apache#2 * Rename `conn_extras` to `connection_extras` for consistency across Kubernetes hooks and operators * Handle AirflowNotFoundException when resolving connection extras in KubernetesPodOperator
Fixes apache#59348. Added is_allowed() method to BaseAuthManager and all implementations to properly delegate HITL permission checks. - SimpleAuthManager: Returns True when simple_auth_manager_all_admins=True - Other managers: Check if user is in assigned_users list - Updated hitl.py to use auth manager's is_allowed() method Remove duplicate import
…onsistency and remove redundant code
- Update method to use keyword-only parameters - Take full user object instead of just user_id - Add unit tests for BaseAuthManager and SimpleAuthManager - Update hitl.py call site to match new signature
Co-authored-by: Vincent <[email protected]>
…m authorization logic for HITL tasks
7267732 to
65f58ed
Compare
@Lee-W Hi! I rebased |
jason810496
left a comment
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.
@Lee-W Hi! I rebased fix-hitl-auth onto main to keep it up to date, which automatically triggered additional review requests.
Just wanted to check if this rebase looks correct. Thanks!
Thanks for the rebase. We still need to resolve the conflicts again. Thanks!
Fixes #59348. Added is_allowed() method to BaseAuthManager and all
implementations to properly delegate HITL permission checks.