Apache Airflow Provider(s)
keycloak
Versions of Apache Airflow Providers
apache-airflow-providers-keycloak==0.5.0
python-keycloak==7.0.1
Apache Airflow version
3.1.6
Operating System
openSUSE Tumbleweed
Deployment
Virtualenv installation
Deployment details
- Keycloak
- Start Keycloak 23.0.6 via breeze keycloak integration
- Create permissions, scopes & resources via
airflow keycloak-auth-manager create-all
- Configure user, admin role and role assignment in Keycloak admin UI
- Airflow
What happened
Following request is sent to Keycloak by the Keycloak auth manager (captured via Wireshark):
POST /realms/airflow/protocol/openid-connect/token HTTP/1.1 (application/x-www-form-urlencoded)
Form data:
grant_type=urn:ietf:params:oauth:grant-type:uma-ticket
audience=airflow
permission=Dag#GET
context=attributes
Note the literal context=attributes in the form data.
When checking on Keycloak side, only the default context attributes are available to JavaScript-based policies:
ctx.attr[kc.realm.name] = [airflow]
ctx.attr[kc.client.user_agent] = [python-requests/2.32.5]
ctx.attr[kc.client.network.ip_address] = [172.18.0.1]
ctx.attr[kc.client.network.host] = [172.18.0.1]
ctx.attr[kc.client.id] = [airflow]
ctx.attr[kc.time.date_time] = [2026-01-27 14:46:36]
What you think should happen instead
Context attributes like dag_id should be sent to Keycloak instead "context=attributes"
How to reproduce
- Start configured Airflow & Keycloak (e.g., via breeze)
- Ensure official example dags are loaded (
load_examples = True in airflow.cfg [core] section)
- Start network capture (e.g., Wireshark)
- Login to Airflow through Keycloak
- Open /dags/asset_produces_1 to produce a
GET /api/v2/dags/asset_produces_1 request
- Observe POST /realms/airflow/protocol/openid-connect/token with form data:
grant_type=urn:ietf:params:oauth:grant-type:uma-ticket
audience=airflow
permission=Dag#GET
context=attributes
Anything else
Maybe related to #51486?
Are you willing to submit PR?
Code of Conduct
Apache Airflow Provider(s)
keycloak
Versions of Apache Airflow Providers
apache-airflow-providers-keycloak==0.5.0
python-keycloak==7.0.1
Apache Airflow version
3.1.6
Operating System
openSUSE Tumbleweed
Deployment
Virtualenv installation
Deployment details
airflow keycloak-auth-manager create-allAirflow 3.1.6 + keycloak auth manager 0.5.0 are installed in separate venv via pip:
Only changes to default airflow.cfg are those required for keycloak_auth_manager:
What happened
Following request is sent to Keycloak by the Keycloak auth manager (captured via Wireshark):
POST /realms/airflow/protocol/openid-connect/token HTTP/1.1 (application/x-www-form-urlencoded)Form data:
Note the literal
context=attributesin the form data.When checking on Keycloak side, only the default context attributes are available to JavaScript-based policies:
What you think should happen instead
Context attributes like
dag_idshould be sent to Keycloak instead "context=attributes"How to reproduce
load_examples = Truein airflow.cfg[core]section)GET /api/v2/dags/asset_produces_1requestAnything else
Maybe related to #51486?
Are you willing to submit PR?
Code of Conduct