Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
)
from flask_appbuilder.models.sqla import Base
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.api import SecurityApi
from flask_appbuilder.security.registerviews import (
RegisterUserDBView,
RegisterUserOAuthView,
Expand Down Expand Up @@ -187,6 +188,10 @@ class FabAirflowSecurityManagerOverride(AirflowSecurityManagerV2):
useroidmodelview = CustomUserOIDModelView
userstatschartview = CustomUserStatsChartView

# API
security_api = SecurityApi
""" Override if you want your own Security API login endpoint """

jwt_manager = None
""" Flask-JWT-Extended """
oauth = None
Expand Down Expand Up @@ -401,6 +406,9 @@ def register_views(self):
if not self.appbuilder.get_app.config.get("FAB_ADD_SECURITY_VIEWS", True):
return

# Security APIs
self.appbuilder.add_api(self.security_api)

if self.auth_user_registration:
if self.auth_type == AUTH_DB:
self.registeruser_view = self.registeruserdbview()
Expand Down Expand Up @@ -743,6 +751,15 @@ 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_provider_name(self):
provider_to_auth_type = {AUTH_DB: "db", AUTH_LDAP: "ldap"}
return provider_to_auth_type.get(self.auth_type)

def _init_config(self):
"""
Initialize config.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,14 @@ def add_view_no_menu(self, baseview, endpoint=None, static_folder=None):
log.warning(LOGMSG_WAR_FAB_VIEW_EXISTS, baseview.__class__.__name__)
return baseview

def add_api(self, baseview):
"""
Add a BaseApi class or child to AppBuilder.

:param baseview: A BaseApi type class
"""
return self.add_view_no_menu(baseview)

@property
def get_url_for_index(self):
return url_for(f"{self.indexview.endpoint}.{self.indexview.default_view}")
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"airflowDefaultTheme.css": "airflowDefaultTheme.ad8dda5568e05025b227.css",
"airflowDefaultTheme.js": "airflowDefaultTheme.ad8dda5568e05025b227.js",
"flash.css": "flash.b79fc1a41842edaebd1e.css",
"flash.js": "flash.b79fc1a41842edaebd1e.js",
"loadingDots.css": "loadingDots.e0e7d08bf05145b507f1.css",
"loadingDots.js": "loadingDots.e0e7d08bf05145b507f1.js",
"main.css": "main.86c51bce5f9ddc8b144c.css",
"main.js": "main.86c51bce5f9ddc8b144c.js",
"materialIcons.css": "materialIcons.64ecd8081995e8cc1b62.css",
"materialIcons.js": "materialIcons.64ecd8081995e8cc1b62.js",
"moment.js": "moment.4dc2e04c449ec8a3b41c.js",
"runtime.js": "runtime.086dc01132a20c74861a.js",
"743.js": "743.365a1eb58dd47776b82f.js",
"airflowDefaultTheme.css": "airflowDefaultTheme.5a4eda684d2f5f33fa6a.css",
"airflowDefaultTheme.js": "airflowDefaultTheme.5a4eda684d2f5f33fa6a.js",
"flash.css": "flash.9f756672299e9e57a824.css",
"flash.js": "flash.9f756672299e9e57a824.js",
"loadingDots.css": "loadingDots.fc35e1feb443bd3a8d80.css",
"loadingDots.js": "loadingDots.fc35e1feb443bd3a8d80.js",
"main.css": "main.26e36c3998f451900260.css",
"main.js": "main.26e36c3998f451900260.js",
"materialIcons.css": "materialIcons.e84a12f5be6e8d456d02.css",
"materialIcons.js": "materialIcons.e84a12f5be6e8d456d02.js",
"moment.js": "moment.9023635a87b836172067.js",
"runtime.js": "runtime.78bb8f6146c25d99b9e2.js",
"743.js": "743.b6629eaae7f541f4158f.js",
"jquery-ui.min.js": "jquery-ui.min.js",
"jquery-ui.min.css": "jquery-ui.min.css",
"oss-licenses.json": "oss-licenses.json",
Expand Down
2 changes: 1 addition & 1 deletion providers/fab/www-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4c92b8af296dfe36ee97ac58235e376c06de0bdac17abe10d68801371f98e009
ea5d18ef9739d782e34aa9b425d7429efb95b81d0753630204124163e1a10051