apache-airflow-providers-fab 2.1.0__py3-none-any.whl → 2.2.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 (41) hide show
  1. airflow/providers/fab/__init__.py +1 -1
  2. airflow/providers/fab/auth_manager/fab_auth_manager.py +0 -4
  3. airflow/providers/fab/auth_manager/models/db.py +1 -0
  4. airflow/providers/fab/auth_manager/security_manager/override.py +10 -2
  5. airflow/providers/fab/get_provider_info.py +28 -0
  6. airflow/providers/fab/www/app.py +2 -3
  7. airflow/providers/fab/www/constants.py +1 -1
  8. airflow/providers/fab/www/extensions/init_jinja_globals.py +4 -4
  9. airflow/providers/fab/www/extensions/init_security.py +0 -19
  10. airflow/providers/fab/www/package-lock.json +127 -796
  11. airflow/providers/fab/www/package.json +7 -7
  12. airflow/providers/fab/www/static/dist/{moment.75a9286ff6019fefe5d9.js → 743.57634ddb93717b7c8c1a.js} +2 -2
  13. airflow/providers/fab/www/static/dist/{moment.75a9286ff6019fefe5d9.js.LICENSE.txt → 743.57634ddb93717b7c8c1a.js.LICENSE.txt} +1 -1
  14. airflow/providers/fab/www/static/dist/airflowDefaultTheme.48540e25fb1e474cef20.js +1 -0
  15. airflow/providers/fab/www/static/dist/flash.02dea0c2ac20820e8d1b.js +1 -0
  16. airflow/providers/fab/www/static/dist/loadingDots.96221bc8b6345c7d65b3.js +1 -0
  17. airflow/providers/fab/www/static/dist/main.49c4d5787ef1f247f004.js +2 -0
  18. airflow/providers/fab/www/static/dist/manifest.json +13 -11
  19. airflow/providers/fab/www/static/dist/materialIcons.4fd835641d53f81af3d3.js +1 -0
  20. airflow/providers/fab/www/static/dist/moment.6943aa3cca9cb1129a71.js +1 -0
  21. airflow/providers/fab/www/static/dist/oss-licenses.json +2 -2
  22. airflow/providers/fab/www/static/dist/runtime.3c1a5fcbb3c1b7c62ad7.js +1 -0
  23. airflow/providers/fab/www/webpack.config.js +6 -0
  24. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/METADATA +8 -8
  25. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/RECORD +36 -34
  26. airflow/providers/fab/www/static/dist/airflowDefaultTheme.a26736fa84b3356edac0.js +0 -1
  27. airflow/providers/fab/www/static/dist/flash.fbcc531a39479aa27065.js +0 -1
  28. airflow/providers/fab/www/static/dist/loadingDots.e1fc82c3ac3f9af3771e.js +0 -1
  29. airflow/providers/fab/www/static/dist/main.eb83be09d97c23018bcb.js +0 -2
  30. airflow/providers/fab/www/static/dist/materialIcons.b21138ea09d0cdf9ffc4.js +0 -1
  31. /airflow/providers/fab/auth_manager/api_fastapi/openapi/{v1-fab-auth-manager-generated.yaml → v2-fab-auth-manager-generated.yaml} +0 -0
  32. /airflow/providers/fab/www/static/dist/{airflowDefaultTheme.a26736fa84b3356edac0.css → airflowDefaultTheme.48540e25fb1e474cef20.css} +0 -0
  33. /airflow/providers/fab/www/static/dist/{flash.fbcc531a39479aa27065.css → flash.02dea0c2ac20820e8d1b.css} +0 -0
  34. /airflow/providers/fab/www/static/dist/{loadingDots.e1fc82c3ac3f9af3771e.css → loadingDots.96221bc8b6345c7d65b3.css} +0 -0
  35. /airflow/providers/fab/www/static/dist/{main.eb83be09d97c23018bcb.css → main.49c4d5787ef1f247f004.css} +0 -0
  36. /airflow/providers/fab/www/static/dist/{main.eb83be09d97c23018bcb.js.LICENSE.txt → main.49c4d5787ef1f247f004.js.LICENSE.txt} +0 -0
  37. /airflow/providers/fab/www/static/dist/{materialIcons.b21138ea09d0cdf9ffc4.css → materialIcons.4fd835641d53f81af3d3.css} +0 -0
  38. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/WHEEL +0 -0
  39. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/entry_points.txt +0 -0
  40. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/licenses/3rd-party-licenses/LICENSES-ui.txt +0 -0
  41. {apache_airflow_providers_fab-2.1.0.dist-info → apache_airflow_providers_fab-2.2.0rc1.dist-info}/licenses/NOTICE +0 -0
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "2.1.0"
32
+ __version__ = "2.2.0"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "3.0.2"
@@ -84,10 +84,8 @@ from airflow.providers.fab.www.security.permissions import (
84
84
  RESOURCE_PLUGIN,
85
85
  RESOURCE_POOL,
86
86
  RESOURCE_PROVIDER,
87
- RESOURCE_SLA_MISS,
88
87
  RESOURCE_TASK_INSTANCE,
89
88
  RESOURCE_TASK_LOG,
90
- RESOURCE_TASK_RESCHEDULE,
91
89
  RESOURCE_TRIGGER,
92
90
  RESOURCE_VARIABLE,
93
91
  RESOURCE_WEBSITE,
@@ -127,7 +125,6 @@ _MAP_DAG_ACCESS_ENTITY_TO_FAB_RESOURCE_TYPE: dict[DagAccessEntity, tuple[str, ..
127
125
  DagAccessEntity.CODE: (RESOURCE_DAG_CODE,),
128
126
  DagAccessEntity.DEPENDENCIES: (RESOURCE_DAG_DEPENDENCIES,),
129
127
  DagAccessEntity.RUN: (RESOURCE_DAG_RUN,),
130
- DagAccessEntity.SLA_MISS: (RESOURCE_SLA_MISS,),
131
128
  # RESOURCE_TASK_INSTANCE has been originally misused. RESOURCE_TASK_INSTANCE referred to task definition
132
129
  # AND task instances without making the difference
133
130
  # To be backward compatible, we translate DagAccessEntity.TASK_INSTANCE to RESOURCE_TASK_INSTANCE AND
@@ -136,7 +133,6 @@ _MAP_DAG_ACCESS_ENTITY_TO_FAB_RESOURCE_TYPE: dict[DagAccessEntity, tuple[str, ..
136
133
  DagAccessEntity.TASK: (RESOURCE_TASK_INSTANCE,),
137
134
  DagAccessEntity.TASK_INSTANCE: (RESOURCE_DAG_RUN, RESOURCE_TASK_INSTANCE),
138
135
  DagAccessEntity.TASK_LOGS: (RESOURCE_TASK_LOG,),
139
- DagAccessEntity.TASK_RESCHEDULE: (RESOURCE_TASK_RESCHEDULE,),
140
136
  DagAccessEntity.VERSION: (RESOURCE_DAG_VERSION,),
141
137
  DagAccessEntity.WARNING: (RESOURCE_DAG_WARNING,),
142
138
  DagAccessEntity.XCOM: (RESOURCE_XCOM,),
@@ -53,6 +53,7 @@ class FABDBManager(BaseDBManager):
53
53
  migration_dir = (PACKAGE_DIR / "migrations").as_posix()
54
54
  alembic_file = (PACKAGE_DIR / "alembic.ini").as_posix()
55
55
  supports_table_dropping = True
56
+ revision_heads_map = _REVISION_HEADS_MAP
56
57
 
57
58
  def create_db_from_orm(self):
58
59
  super().create_db_from_orm()
@@ -2132,8 +2132,16 @@ class FabAirflowSecurityManagerOverride(AirflowSecurityManagerV2):
2132
2132
  "username": me["nickname"],
2133
2133
  "role_keys": me.get("groups", []),
2134
2134
  }
2135
-
2136
- return {}
2135
+ # for other providers
2136
+ data = self.oauth_remotes[provider].userinfo()
2137
+ log.debug("User info from %s: %s", provider, data)
2138
+ return {
2139
+ "username": data.get("preferred_username", ""),
2140
+ "first_name": data.get("given_name", ""),
2141
+ "last_name": data.get("family_name", ""),
2142
+ "email": data.get("email", ""),
2143
+ "role_keys": data.get("groups", []),
2144
+ }
2137
2145
 
2138
2146
  @staticmethod
2139
2147
  def oauth_token_getter():
@@ -30,6 +30,34 @@ def get_provider_info():
30
30
  "fab": {
31
31
  "description": "This section contains configs specific to FAB provider.",
32
32
  "options": {
33
+ "navbar_color": {
34
+ "description": "Define the color of navigation bar\n",
35
+ "version_added": "2.2.0",
36
+ "type": "string",
37
+ "example": None,
38
+ "default": "#fff",
39
+ },
40
+ "navbar_text_color": {
41
+ "description": "Define the color of text in the navigation bar\n",
42
+ "version_added": "2.2.0",
43
+ "type": "string",
44
+ "example": None,
45
+ "default": "#51504f",
46
+ },
47
+ "navbar_hover_color": {
48
+ "description": "Define the color of navigation bar links when hovered\n",
49
+ "version_added": "2.2.0",
50
+ "type": "string",
51
+ "example": None,
52
+ "default": "#eee",
53
+ },
54
+ "navbar_text_hover_color": {
55
+ "description": "Define the color of text in the navigation bar when hovered\n",
56
+ "version_added": "2.2.0",
57
+ "type": "string",
58
+ "example": None,
59
+ "default": "#51504f",
60
+ },
33
61
  "access_denied_message": {
34
62
  "description": "The message displayed when a user attempts to execute actions beyond their authorised privileges.\n",
35
63
  "version_added": "2.1.0",
@@ -33,7 +33,7 @@ from airflow.logging_config import configure_logging
33
33
  from airflow.providers.fab.www.extensions.init_appbuilder import init_appbuilder
34
34
  from airflow.providers.fab.www.extensions.init_jinja_globals import init_jinja_globals
35
35
  from airflow.providers.fab.www.extensions.init_manifest_files import configure_manifest_files
36
- from airflow.providers.fab.www.extensions.init_security import init_api_auth, init_xframe_protection
36
+ from airflow.providers.fab.www.extensions.init_security import init_api_auth
37
37
  from airflow.providers.fab.www.extensions.init_session import init_airflow_session_interface
38
38
  from airflow.providers.fab.www.extensions.init_views import (
39
39
  init_api_auth_provider,
@@ -56,7 +56,7 @@ def create_app(enable_plugins: bool):
56
56
  from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager
57
57
 
58
58
  flask_app = Flask(__name__)
59
- flask_app.secret_key = conf.get("webserver", "SECRET_KEY")
59
+ flask_app.secret_key = conf.get("api", "SECRET_KEY")
60
60
  flask_app.config["SQLALCHEMY_DATABASE_URI"] = conf.get("database", "SQL_ALCHEMY_CONN")
61
61
  flask_app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
62
62
  flask_app.config["PERMANENT_SESSION_LIFETIME"] = timedelta(minutes=get_session_lifetime_config())
@@ -102,7 +102,6 @@ def create_app(enable_plugins: bool):
102
102
  init_api_auth_provider(flask_app)
103
103
  init_api_error_handlers(flask_app)
104
104
  init_jinja_globals(flask_app, enable_plugins=enable_plugins)
105
- init_xframe_protection(flask_app)
106
105
  init_airflow_session_interface(flask_app)
107
106
  init_wsgi_middleware(flask_app)
108
107
  return flask_app
@@ -24,5 +24,5 @@ WWW = Path(__file__).resolve().parent
24
24
  # There is a difference with configuring Swagger in Connexion 2.x and Connexion 3.x
25
25
  # Connexion 2: https://connexion.readthedocs.io/en/2.14.2/quickstart.html#the-swagger-ui-console
26
26
  # Connexion 3: https://connexion.readthedocs.io/en/stable/swagger_ui.html#configuring-the-swagger-ui
27
- SWAGGER_ENABLED = conf.getboolean("webserver", "enable_swagger_ui", fallback=True)
27
+ SWAGGER_ENABLED = conf.getboolean("api", "enable_swagger_ui", fallback=True)
28
28
  SWAGGER_BUNDLE = WWW.joinpath("static", "dist", "swagger-ui")
@@ -52,10 +52,10 @@ def init_jinja_globals(app, enable_plugins: bool):
52
52
  extra_globals = {
53
53
  "server_timezone": server_timezone,
54
54
  "hostname": hostname,
55
- "navbar_color": conf.get("webserver", "NAVBAR_COLOR"),
56
- "navbar_text_color": conf.get("webserver", "NAVBAR_TEXT_COLOR"),
57
- "navbar_hover_color": conf.get("webserver", "NAVBAR_HOVER_COLOR"),
58
- "navbar_text_hover_color": conf.get("webserver", "NAVBAR_TEXT_HOVER_COLOR"),
55
+ "navbar_color": conf.get("fab", "NAVBAR_COLOR"),
56
+ "navbar_text_color": conf.get("fab", "NAVBAR_TEXT_COLOR"),
57
+ "navbar_hover_color": conf.get("fab", "NAVBAR_HOVER_COLOR"),
58
+ "navbar_text_hover_color": conf.get("fab", "NAVBAR_TEXT_HOVER_COLOR"),
59
59
  "airflow_version": airflow_version,
60
60
  "git_version": git_version,
61
61
  "show_plugin_message": enable_plugins,
@@ -25,25 +25,6 @@ from airflow.exceptions import AirflowException
25
25
  log = logging.getLogger(__name__)
26
26
 
27
27
 
28
- def init_xframe_protection(app):
29
- """
30
- Add X-Frame-Options header.
31
-
32
- Use it to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.
33
-
34
- See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
35
- """
36
- x_frame_enabled = conf.getboolean("webserver", "X_FRAME_ENABLED", fallback=True)
37
- if x_frame_enabled:
38
- return
39
-
40
- def apply_caching(response):
41
- response.headers["X-Frame-Options"] = "DENY"
42
- return response
43
-
44
- app.after_request(apply_caching)
45
-
46
-
47
28
  def init_api_auth(app):
48
29
  """Load authentication backends."""
49
30
  auth_backends = conf.get(