Skip to main content

Allowing OIDC Login to airflow.

Project description

This repo contains a provider package for apache airflow.

It provides an auth_manager that is able to connect to any OIDC compliant Identity Provider, and manages user permissions based on their group memberships, which are mapped to team-roles.

The exact mapping is still work in progress, but it should conform to the roles defined as the current airflow default roles: ANONYMOUS, VIEWER, USER, OPERATOR and ADMIN.

An example config via variables in a yaml file can look like this:

AIRFLOW__OAUTH2_AUTH_MANAGER__CLIENT_ID: airflow
AIRFLOW__OAUTH2_AUTH_MANAGER__CLIENT_SECRET: 'secret configured in the IdP'
AIRFLOW__OAUTH2_AUTH_MANAGER__SERVER_URL: https://someserver:1234/realms/airflow/.well-known/openid-configuration
AIRFLOW__OAUTH2_AUTH_MANAGER__SCOPES: "profile email openid roles"
AIRFLOW__OAUTH2_AUTH_MANAGER__TOKEN_PARSER_CLASS: airflow_oidc_provider.auth_manager.token_parser.SimpleOIDCTokenParser
AIRFLOW__OAUTH2_AUTH_MANAGER__TOKEN_PARSER_CONFIG: |
{
    "token_key" : "token_key",
    "admin_group" : "admin",
    "teams" : {
        "Team 1" : {
            "team1:operator" : "operator",
            "team1:user" : "user"
        },
        "Team 2" : {
            "team2:operator" : "operator",
            "team2:viewer" : "viewer",
            "team2:user" : "user"
        }
    }
}

Configuration Options

Option name

default

description

AIRFLOW__OAUTH2_AUTH_MANAGER__CLIENT_ID

mandatory

The client id to be used with the IdP.

AIRFLOW__OAUTH2_AUTH_MANAGER__CLIENT_SECRET

mandatory

The client secret to be used with the IdP.

AIRFLOW__OAUTH2_AUTH_MANAGER__SERVER_URL

mandatory

The URL for the OIDC endpoint of the IdP. Often ends in ‘.well-known/openid-configuration’.

AIRFLOW__OAUTH2_AUTH_MANAGER__SCOPES

profile email openid roles

The scopes that need to be requested for the token to contain groups information.

AIRFLOW__OAUTH2_AUTH_MANAGER__TOKEN_PARSER_CLASS

airflow_oidc_provider.auth_manager.token_parser.SimpleOIDCTokenParser

The class that parses the OIDC token for userinformation.

AIRFLOW__OAUTH2_AUTH_MANAGER__TOKEN_PARSER_CONFIG

mandatory for default class, else depends on class

A config string for the parser class. More details for the default class below.

SimpleOIDCTokenParser

The SimpleOIDCTokenParser parses the userinfo returned by the IdP for team memberships and access level of the user. To configure it for your specific IdP, and to support slightly off-standard IdPs, it requires some information to parse a token.

The configuration string should be in json format.

json key

description

token_key

The key within the userinfo token, which contains the list of groups the user is a member of

admin_group

The name of the group in the userinfo token, which will be matched to airflow ADMIN permissions.

teams

This contains nested json objects. On the first Level will be a team name as key, its value will be

a mapping from groups from the userinfo token to the name of the role to be given for this team in airflow.

Testing

The testcases included in this repository depend on some internal airflow development packages, which are not provided in a public registry, and had to be built from source.

Therefore those testcases are not run if the required packages are not present.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_oidc_provider-0.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airflow_oidc_provider-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file airflow_oidc_provider-0.2.0.tar.gz.

File metadata

  • Download URL: airflow_oidc_provider-0.2.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for airflow_oidc_provider-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5884b9566af5f64e2c5e218afb8f1542225840090a8cc1b0a4e5482d75113bad
MD5 fa2346b997211605bec0f7337093a2c5
BLAKE2b-256 0212eb3b8053d7e98c4d0bdd47692d382ef12d23eda2d789384396abe9db528e

See more details on using hashes here.

Provenance

The following attestation bundles were made for airflow_oidc_provider-0.2.0.tar.gz:

Publisher: python-publish.yml on cboettcher/airflow-oidc-provider

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file airflow_oidc_provider-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_oidc_provider-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb1d2cc14b5a50845a34e3cf3381ff7220067299e8b4aa541840d603ca498f3
MD5 6b80c9315fbe7a00b29f156d81c6ddb7
BLAKE2b-256 bdea78562e774c9cdf23f04a2320b26556cf5ff0de2e75ca43f0e7157b2f26f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for airflow_oidc_provider-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on cboettcher/airflow-oidc-provider

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page