Add machine-readable RBAC reference to BaseAuthManager - #72495
Open
anmolxlight wants to merge 2 commits into
Open
Add machine-readable RBAC reference to BaseAuthManager#72495anmolxlight wants to merge 2 commits into
anmolxlight wants to merge 2 commits into
Conversation
Issue 72465 asks for an autogenerated spec of the FastAPI RBAC permissions so provider auth managers can model them externally without hand-maintaining a copy. BaseAuthManager.get_rbac_reference introspects the is_authorized_* methods, so the reference stays in sync automatically when resources change. Also adds an RBAC reference docs page, unit tests, and a newsfragment. Signed-off-by: anmolxlight <anmolxlight@gmail.com>
Signed-off-by: anmolxlight <anmolx.work@gmail.com>
vincbeck
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #72465.
Provider auth managers like the Keycloak auth manager need to model the Airflow RBAC permissions in an external system, which today means hand-maintaining a copy of the RBAC surface. This adds
BaseAuthManager.get_rbac_reference(), a machine-readable reference introspected from theis_authorized_*methods, so it stays in sync automatically whenever resources are added or changed.Each entry is keyed by resource name (e.g.
"dag") and holds the authorizing method, allowed actions, scoping enum with values (e.g.DagAccessEntity,AccessView), details dataclass fields (e.g.DagDetails), and a short description. The reference is JSON-serializable so external systems can consume it directly.Also adds an "RBAC reference" docs page under Auth manager concepts, unit tests, and a newsfragment.
Skipped: a dedicated Sphinx extension or prek codegen hook. The runtime-introspected method cannot drift by construction; add codegen only if a static artifact is ever required.
Test Plan
TestGetRbacReferencetests pass (64 passed intest_base_auth_manager.py)ruff checkandruff format --checkpass on changed filesmypy-airflow-coreprek hook passesprek run --from-ref apache/main --stage pre-commitpasses (includes newsfragment validation)