Skip to content

Add machine-readable RBAC reference to BaseAuthManager - #72495

Open
anmolxlight wants to merge 2 commits into
apache:mainfrom
anmolxlight:rbac-reference-72465
Open

Add machine-readable RBAC reference to BaseAuthManager#72495
anmolxlight wants to merge 2 commits into
apache:mainfrom
anmolxlight:rbac-reference-72465

Conversation

@anmolxlight

Copy link
Copy Markdown
Contributor

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 the is_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

  • New TestGetRbacReference tests pass (64 passed in test_base_auth_manager.py)
  • ruff check and ruff format --check pass on changed files
  • mypy-airflow-core prek hook passes
  • prek run --from-ref apache/main --stage pre-commit passes (includes newsfragment validation)

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>
@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API kind:documentation labels Sep 3, 2026
Signed-off-by: anmolxlight <anmolx.work@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autogenerate API Auth RBAC docs from the FastAPI permissions

2 participants