Skip to content

Instantly share code, notes, and snippets.

View chrismclennon's full-sized avatar

Chris McLennon chrismclennon

  • Datadog
  • New York
View GitHub Profile
@chrismclennon
chrismclennon / custom_ldap_auth.py
Last active November 11, 2022 14:45
Custom auth backend to support LDAP for API calls
# Install instructions:
# * Place file inside of Airflow path. For example: /usr/local/lib/python3.6/site-packages/airflow/custom/auth/backends/custom_ldap_auth.py
# * In airflow.cfg, reference field api.auth_backend = airflow.custom.auth.backends.custom_ldap_auth
# * Rewrite logic for function `requires_authentication()` to suit your own needs. This implementation checks to see if the
# LDAP user's role is equal to the "owner" field.
from functools import wraps
import base64
from flask import Response, make_response

Keybase proof

I hereby claim:

  • I am chrismclennon on github.
  • I am chrismclennon (https://keybase.io/chrismclennon) on keybase.
  • I have a public key ASA89s6t9dbvPEf-G6ZXtKn1kQXjEXUmt3-AY_nuUkg4yQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

To claim this, I am signing this object: