Skip to content

triauth for Apache AirflowOIDC

Let your data team open the Airflow interface with one approval on their own device, and no Airflow passwords.

  • Data pipelines
  • Open source
Sign-in through
OpenID Connect bridge
Available in
Self-managed Airflow 2 and 3, with the FAB auth manager
Set up in
webserver_config.py

About Apache Airflow

Apache Airflow is a workflow scheduler. Data and platform teams write pipelines in Python, and Airflow runs them on a schedule, retries failures, and shows progress in a web interface. It is the standard tool for orchestrating data jobs, and the managed services built on it keep their own sign-in.

Connect Apache Airflow to triauth

Airflow signs people in through the triauth OpenID Connect bridge, with the Flask-AppBuilder auth manager. Once connected, the login page shows Sign In with and your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps an Airflow password, and when someone leaves, removing their identity records at your domain ends their access to Airflow as well.

How it works

  1. Open oidc.triauth.org and enter your domain. Paste Airflow's redirect address, https://airflow.example.com/auth/oauth-authorized/example.com with your own Airflow address in place of airflow.example.com, and click Connect app. The bridge gives you a client ID and a client secret. On Airflow 2, the address has no /auth part.

  2. On Airflow 3, install the package apache-airflow-providers-fab and set auth_manager in the [core] section of airflow.cfg to airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager. Airflow 2 uses it already.

  3. Add the settings below to webserver_config.py and restart the web server. Replace example.com with your domain and the two placeholders with the client ID and the client secret from the bridge.

    python
    from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
    from flask_appbuilder.security.manager import AUTH_OAUTH
    
    AUTH_TYPE = AUTH_OAUTH
    OAUTH_PROVIDERS = [{
        'name': 'example.com',
        'icon': 'fa-key',
        'token_key': 'access_token',
        'remote_app': {
            'client_id': '<client ID from the bridge>',
            'client_secret': '<client secret from the bridge>',
            'server_metadata_url': 'https://oidc.triauth.org/example.com/.well-known/openid-configuration',
            'client_kwargs': {'scope': 'openid email profile groups'},
        },
    }]
    AUTH_USER_REGISTRATION = True
    AUTH_USER_REGISTRATION_ROLE = 'Viewer'
    AUTH_ROLES_MAPPING = {'airflow-admins@example.com': ['Admin'], 'data-team@example.com': ['Op']}
    AUTH_ROLES_SYNC_AT_LOGIN = True
  4. Open Airflow's login page and click Sign In with example.com.

Checkpoint

Airflow's login page shows Sign In with example.com. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.

Good to know

  • Everyone with an identity at your domain gets an Airflow user the first time they sign in, named after their username, such as john, as a Viewer unless a mapped group says otherwise. To let only one team in, limit the app to a group when you connect it.
  • AUTH_ROLES_MAPPING turns the groups published at your domain into Airflow roles, and the sync setting re-applies them at every sign-in.
  • Amazon MWAA, Astronomer, and Google Cloud Composer sign people in their own way, so this page is about an Airflow you run yourself.

For the person who connects the app

SettingValue
Redirect addresshttps://<your-airflow>/auth/oauth-authorized/<provider name> on Airflow 3, https://<your-airflow>/oauth-authorized/<provider name> on Airflow 2, where the provider name is the name above
Where in Airflowwebserver_config.py, plus [core] auth_manager in airflow.cfg on Airflow 3
Metadata URLserver_metadata_url takes the bridge's discovery document, and the rest comes from there
Airflow 2the Flask-AppBuilder shipped with older Airflow 2 releases knows only named providers. There, add a small security manager class with get_oauth_user_info, as the guide's Keycloak example shows, or reuse a name such as okta whose branch reads standard claims
ClaimsAirflow 3's provider reads preferred_username, email, and groups from the userinfo endpoint for any provider name. The username becomes the Airflow user name, so an existing user with that name, such as admin, becomes the person's

Airflow keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. Airflow's webserver authentication guide explains every setting, and the Airflow 3 upgrade guide covers the auth manager switch.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.