Skip to content

feat: Add support for both basic and Cognito bearer auth for Airflow API #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pymonger
Copy link
Collaborator

@pymonger pymonger commented Jul 17, 2025

Summary

This PR adds support for both legacy Basic Auth and Cognito Bearer Token authentication (OAuth2 and InitiateAuth flows) for submitting DAG runs to the Airflow API. It also updates the router config schema, documentation, and adds comprehensive unit tests.

Key Changes

  • submit_dag_by_id.py now supports:
    • auth_method: basic (legacy username/password)
    • auth_method: bearer with cognito_token_method: oauth2 (OIDC/JWT)
    • auth_method: bearer with cognito_token_method: initiate_auth (AWS-native)
  • Router config schema updated to allow all relevant fields for both auth methods
  • README updated with full example configs and usage guidance
  • New unit tests for all authentication modes and token refresh logic
  • Pre-commit, linting, and formatting compliance
  • Version bumped to 0.0.2

Motivation

  • Enables secure, flexible authentication for Airflow APIs behind ALB/API Gateway with Cognito
  • Provides clear documentation and examples for users
  • Ensures robust, tested, and maintainable code

Checklist

  • Code and tests updated
  • Documentation updated
  • Pre-commit hooks passing
  • Version bumped

@pymonger pymonger requested a review from LucaCinquini July 23, 2025 17:29
Copy link

@LucaCinquini LucaCinquini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pymonger : impressive amount of work, thank you. I have a few questions to discuss later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants