Skip to content

Conversation

@TempestShaw
Copy link

Fixes #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

  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
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 14, 2025

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)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

Copy link
Member

@jason810496 jason810496 left a 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.

@jason810496 jason810496 requested a review from Lee-W December 14, 2025 10:20
Copy link
Member

@jason810496 jason810496 left a 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!

@TempestShaw
Copy link
Author

Thanks, will do after a long haul flight.

@vincbeck
Copy link
Contributor

Some comments but the overall direction is good I think

@vincbeck
Copy link
Contributor

Please also update documentation to mention this new API in Authorization related methods section

- 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
Copy link
Member

@Lee-W Lee-W left a 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

@potiuk
Copy link
Member

potiuk commented Dec 16, 2025

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.

@potiuk
Copy link
Member

potiuk commented Dec 16, 2025

Looks way better now :)

dabla and others added 12 commits December 24, 2025 09:29
…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]>
…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
- 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
@TempestShaw
Copy link
Author

Hey @TempestShaw , I think we're close to merging this one. Could you please help us resolve the remaining comments and conflicts? Thanks!

@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!

Copy link
Member

@jason810496 jason810496 left a 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!

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ApprovalOperator(assigned_users=...) unusable with SimpleAuthManager when simple_auth_manager_all_admins=True (no one can approve/reject)