apache-airflow-providers-fab 1.5.3rc1__py3-none-any.whl → 2.0.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. airflow/providers/fab/__init__.py +3 -3
  2. airflow/providers/fab/auth_manager/api/auth/backend/basic_auth.py +1 -1
  3. airflow/providers/fab/auth_manager/api/auth/backend/kerberos_auth.py +1 -1
  4. airflow/providers/fab/auth_manager/api/auth/backend/session.py +1 -1
  5. airflow/providers/fab/auth_manager/api_endpoints/role_and_permission_endpoint.py +1 -1
  6. airflow/providers/fab/auth_manager/api_endpoints/user_endpoint.py +1 -1
  7. airflow/providers/fab/auth_manager/cli_commands/db_command.py +1 -1
  8. airflow/providers/fab/auth_manager/cli_commands/utils.py +4 -16
  9. airflow/providers/fab/auth_manager/decorators/auth.py +3 -2
  10. airflow/providers/fab/auth_manager/fab_auth_manager.py +26 -20
  11. airflow/providers/fab/auth_manager/security_manager/override.py +7 -135
  12. airflow/providers/fab/get_provider_info.py +4 -5
  13. airflow/providers/fab/www/__init__.py +17 -0
  14. airflow/providers/fab/www/app.py +87 -0
  15. airflow/providers/fab/www/extensions/__init__.py +16 -0
  16. airflow/providers/fab/www/extensions/init_appbuilder.py +557 -0
  17. airflow/providers/fab/www/extensions/init_jinja_globals.py +80 -0
  18. airflow/providers/fab/www/extensions/init_manifest_files.py +61 -0
  19. airflow/providers/fab/www/extensions/init_security.py +42 -0
  20. airflow/providers/fab/www/extensions/init_views.py +67 -0
  21. airflow/providers/fab/www/package-lock.json +21201 -0
  22. airflow/providers/fab/www/package.json +156 -0
  23. airflow/providers/fab/www/static/css/bootstrap-theme.css +6215 -0
  24. airflow/providers/fab/www/static/css/loading-dots.css +60 -0
  25. airflow/providers/fab/www/static/css/main.css +676 -0
  26. airflow/providers/fab/www/static/css/material-icons.css +84 -0
  27. airflow/providers/fab/www/static/js/datetime_utils.js +134 -0
  28. airflow/providers/fab/www/static/js/main.js +324 -0
  29. airflow/providers/fab/www/static/sort_asc.png +0 -0
  30. airflow/providers/fab/www/static/sort_both.png +0 -0
  31. airflow/providers/fab/www/static/sort_desc.png +0 -0
  32. airflow/providers/fab/www/templates/airflow/_messages.html +30 -0
  33. airflow/providers/fab/www/templates/airflow/error.html +35 -0
  34. airflow/providers/fab/www/templates/airflow/main.html +79 -0
  35. airflow/providers/fab/www/templates/airflow/traceback.html +57 -0
  36. airflow/providers/fab/www/templates/appbuilder/index.html +20 -0
  37. airflow/providers/fab/www/templates/appbuilder/navbar.html +53 -0
  38. airflow/providers/fab/www/templates/appbuilder/navbar_menu.html +60 -0
  39. airflow/providers/fab/www/webpack.config.js +248 -0
  40. {apache_airflow_providers_fab-1.5.3rc1.dist-info → apache_airflow_providers_fab-2.0.0rc1.dist-info}/METADATA +10 -10
  41. {apache_airflow_providers_fab-1.5.3rc1.dist-info → apache_airflow_providers_fab-2.0.0rc1.dist-info}/RECORD +43 -16
  42. {apache_airflow_providers_fab-1.5.3rc1.dist-info → apache_airflow_providers_fab-2.0.0rc1.dist-info}/WHEEL +0 -0
  43. {apache_airflow_providers_fab-1.5.3rc1.dist-info → apache_airflow_providers_fab-2.0.0rc1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,42 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ from __future__ import annotations
18
+
19
+ import logging
20
+
21
+ from airflow.configuration import conf
22
+
23
+ log = logging.getLogger(__name__)
24
+
25
+
26
+ def init_xframe_protection(app):
27
+ """
28
+ Add X-Frame-Options header.
29
+
30
+ Use it to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.
31
+
32
+ See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
33
+ """
34
+ x_frame_enabled = conf.getboolean("webserver", "X_FRAME_ENABLED", fallback=True)
35
+ if x_frame_enabled:
36
+ return
37
+
38
+ def apply_caching(response):
39
+ response.headers["X-Frame-Options"] = "DENY"
40
+ return response
41
+
42
+ app.after_request(apply_caching)
@@ -0,0 +1,67 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ from __future__ import annotations
18
+
19
+ import logging
20
+ from typing import TYPE_CHECKING
21
+
22
+ if TYPE_CHECKING:
23
+ from flask import Flask
24
+
25
+ log = logging.getLogger(__name__)
26
+
27
+
28
+ def init_plugins(app):
29
+ """Integrate Flask and FAB with plugins."""
30
+ from airflow import plugins_manager
31
+
32
+ plugins_manager.initialize_flask_plugins()
33
+
34
+ appbuilder = app.appbuilder
35
+
36
+ for view in plugins_manager.flask_appbuilder_views:
37
+ name = view.get("name")
38
+ if name:
39
+ filtered_view_kwargs = {k: v for k, v in view.items() if k not in ["view"]}
40
+ log.debug("Adding view %s with menu", name)
41
+ baseview = view.get("view")
42
+ if baseview:
43
+ appbuilder.add_view(baseview, **filtered_view_kwargs)
44
+ else:
45
+ log.error("'view' key is missing for the named view: %s", name)
46
+ else:
47
+ # if 'name' key is missing, intent is to add view without menu
48
+ log.debug("Adding view %s without menu", str(type(view["view"])))
49
+ appbuilder.add_view_no_menu(view["view"])
50
+
51
+ for menu_link in sorted(
52
+ plugins_manager.flask_appbuilder_menu_links, key=lambda x: (x.get("category", ""), x["name"])
53
+ ):
54
+ log.debug("Adding menu link %s to %s", menu_link["name"], menu_link["href"])
55
+ appbuilder.add_link(**menu_link)
56
+
57
+ for blue_print in plugins_manager.flask_blueprints:
58
+ log.debug("Adding blueprint %s:%s", blue_print["name"], blue_print["blueprint"].import_name)
59
+ app.register_blueprint(blue_print["blueprint"])
60
+
61
+
62
+ def init_error_handlers(app: Flask):
63
+ """Add custom errors handlers."""
64
+ from airflow.www import views
65
+
66
+ app.register_error_handler(500, views.show_traceback)
67
+ app.register_error_handler(404, views.not_found)