This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 8cbf9340ec020810b505d0ccf197435eb0e8a704
Author: Pankaj Singh <aa3pan...@gmail.com>
AuthorDate: Fri Feb 18 02:25:22 2022 +0530

    Adding missing login provider related methods from Flask-Appbuilder (#21294)
    
    (cherry picked from commit 38894e8013b5c38468e912164f80282e3b579993)
---
 airflow/www/fab_security/manager.py | 15 +++++++++++++++
 setup.cfg                           |  7 ++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/airflow/www/fab_security/manager.py 
b/airflow/www/fab_security/manager.py
index e340c17..f5385a6 100644
--- a/airflow/www/fab_security/manager.py
+++ b/airflow/www/fab_security/manager.py
@@ -187,6 +187,7 @@ class BaseSecurityManager:
         # 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:
@@ -293,11 +294,21 @@ class BaseSecurityManager:
         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"""
         return self.registerusermodelview.datamodel
@@ -308,6 +319,10 @@ class BaseSecurityManager:
         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"""
         return self.appbuilder.get_app.config["AUTH_TYPE"]
diff --git a/setup.cfg b/setup.cfg
index 8e36d06..12bdeae 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -104,7 +104,12 @@ install_requires =
     #      https://github.com/readthedocs/sphinx_rtd_theme/issues/1115
     docutils<0.17
     flask>=1.1.0, <2.0
-    flask-appbuilder>=3.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,

Reply via email to