From 59f92eb737de0e14aeaffb21d7b3f764f4392f8e Mon Sep 17 00:00:00 2001 From: Michal Owczarek Date: Thu, 24 Aug 2023 12:44:48 +0200 Subject: [PATCH] SECURITY_MANAGER_CLASS should be a referrence to class, not a string --- docs/apache-airflow/security/webserver.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/apache-airflow/security/webserver.rst b/docs/apache-airflow/security/webserver.rst index 9e4c947ee7a88..d990afa4d4536 100644 --- a/docs/apache-airflow/security/webserver.rst +++ b/docs/apache-airflow/security/webserver.rst @@ -169,14 +169,14 @@ Here is an example of what you might have in your webserver_config.py: .. code-block:: python + from airflow.www.security import AirflowSecurityManager from flask_appbuilder.security.manager import AUTH_OAUTH import os AUTH_TYPE = AUTH_OAUTH AUTH_ROLES_SYNC_AT_LOGIN = True # Checks roles on every login AUTH_USER_REGISTRATION = True # allow users who are not already in the FAB DB to register - # Make sure to replace this with the path to your security manager class - SECURITY_MANAGER_CLASS = "your_module.your_security_manager_class" + AUTH_ROLES_MAPPING = { "Viewer": ["Viewer"], "Admin": ["Admin"], @@ -199,6 +199,14 @@ Here is an example of what you might have in your webserver_config.py: }, ] + + class CustomSecurityManager(AirflowSecurityManager): + pass + + + # Make sure to replace this with your own implementation of AirflowSecurityManager class + SECURITY_MANAGER_CLASS = CustomSecurityManager + Here is an example of defining a custom security manager. This class must be available in Python's path, and could be defined in webserver_config.py itself if you wish.