Skip to content

Apply configuration defined in webserver_config.py to Flask config - #48898

Merged
kaxil merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/flask_config
Apr 7, 2025
Merged

Apply configuration defined in webserver_config.py to Flask config#48898
kaxil merged 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/flask_config

Conversation

@vincbeck

Copy link
Copy Markdown
Contributor

In AF2 you can extend the Flask application configuration in $AIRFLOW_HOME/webserver_config.py. We must keep this mechanism in FAB provider in AF3 because many users rely on it (and some features as well). The documentation refers to this file as well. This is an issue reported by @zachliu on Slack.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

ashb
ashb approved these changes Apr 7, 2025
@kaxil
kaxil merged commit 3039600 into apache:mainApr 7, 2025
@vincbeck
vincbeck deleted the vincbeck/flask_config branch April 7, 2025 22:04
simonprydden pushed a commit to simonprydden/airflow that referenced this pull request Apr 8, 2025
@potiuk

Copy link
Copy Markdown
Member

nice!

@zachliu

Copy link
Copy Markdown
Contributor

Here’s a summary of the issue (Slack messages only have a 90-day lifespan):

  • Airflow version: 3.0.0rc1.post2, providers-fab version: 2.0.0rc3

  • airflow.cfg contains:

    [core]auth_manager = airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
    [fab]auth_backends = airflow.providers.fab.auth_manager.api.auth.backend.basic_auth,airflow.providers.fab.auth_manager.api.auth.backend.session
  • symptom: the OAuth login page does not load
    2025-04-07_14-41

  • webserver_config.py is set up following FAB documentation:

    from __future__ importannotationsimportosfromairflow.providers.fab.auth_manager.security_manager.overrideimport (
    FabAirflowSecurityManagerOverride,
    )
    fromflask_appbuilder.constimportAUTH_OAUTH# Flask-WTF flag for CSRFWTF_CSRF_ENABLED=TrueWTF_CSRF_TIME_LIMIT=NoneAUTH_TYPE=AUTH_OAUTHAUTH_USER_REGISTRATION=TrueAUTH_USER_REGISTRATION_ROLE=NoneAUTH_ROLES_SYNC_AT_LOGIN=TrueOAUTH_PROVIDERS= [
    {
    'name': 'auth0',
    ...
    },
    ]
    classCustomSecurityManager(FabAirflowSecurityManagerOverride):
    """Custom Security Manager"""SECURITY_MANAGER_CLASS=CustomSecurityManager
  • Confusing log entry observed:

    webserver-1 | [2025-04-07T20:07:23.995+0000] {override.py:824} DEBUG - OAuth providers init auth0
    

Solution:

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@vincbeck@potiuk@zachliu@ashb@kaxil