Skip to content
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

DONT-MERGE: running 21294 on a self hosted runner #21652

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions airflow/www/fab_security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def __init__(self, appbuilder):
# Role Mapping
app.config.setdefault("AUTH_ROLES_MAPPING", {})
app.config.setdefault("AUTH_ROLES_SYNC_AT_LOGIN", False)
app.config.setdefault("AUTH_API_LOGIN_ALLOW_MULTIPLE_PROVIDERS", False)

# LDAP Config
if self.auth_type == AUTH_LDAP:
Expand Down Expand Up @@ -322,11 +323,21 @@ def get_roles_from_keys(self, role_keys: List[str]) -> Set[RoleModelView]:
log.warning(f"Can't find role specified in AUTH_ROLES_MAPPING: {fab_role_name}")
return _roles

@property
def auth_type_provider_name(self):
provider_to_auth_type = {AUTH_DB: "db", AUTH_LDAP: "ldap"}
return provider_to_auth_type.get(self.auth_type)

@property
def get_url_for_registeruser(self):
"""Gets the URL for Register User"""
return url_for(f"{self.registeruser_view.endpoint}.{self.registeruser_view.default_view}")

@property
def get_user_datamodel(self):
"""Gets the User data model"""
return self.user_view.datamodel

@property
def get_register_user_datamodel(self):
"""Gets the Register User data model"""
Expand All @@ -337,6 +348,10 @@ def builtin_roles(self):
"""Get the builtin roles"""
return self._builtin_roles

@property
def api_login_allow_multiple_providers(self):
return self.appbuilder.get_app.config["AUTH_API_LOGIN_ALLOW_MULTIPLE_PROVIDERS"]

@property
def auth_type(self):
"""Get the auth type"""
Expand Down
9 changes: 6 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ install_requires =
# Serious breaking changes. Flask 2.0 has been introduced in May 2021 and 2.0.2 version is available
# now (Feb 2022): TODO: we should attempt to migrate to Flask 2 and all below flask libraries soon.
flask>=1.1.0, <2.0
# FlaskAppBuilder is very tight integration for UI but we are likely to remove it as a dependency soon
# TODO: Remove it when we are ready
flask-appbuilder~=3.4, <4.0.0
# We are tightly coupled with FAB version because we vendored in part of FAB code related to security manager
# This is done as part of preparation to removing FAB as dependency, but we are not ready for it yet
# Every time we update FAB version here, please make sure that you review the classes and models in
# `airflow/www/fab_security` with their upstream counterparts. In particular, make sure any breaking changes,
# for example any new methods, are accounted for.
flask-appbuilder==3.4.4
flask-caching>=1.5.0, <2.0.0
flask-login>=0.3, <0.5
# Strict upper-bound on the latest release of flask-session,
Expand Down