简体   繁体   English

不能使用 LDAP 的本地用户

[英]Can't use local user with LDAP

I'm trying to integrate the apache superset with LDAP.我正在尝试将 apache 超集与 LDAP 集成。 with the configuration that I will provide below I can log in superset web with LDAP user but at the same time I can't log in with local users, such as admin, which was created during installation.使用我将在下面提供的配置,我可以使用 LDAP 用户登录超集 web,但同时我无法使用安装期间创建的本地用户(例如管理员)登录。 What is the problem?问题是什么?

Also, I'm trying to split permission roles with "AUTH_ROLES_MAPPING" but with no luck yet.另外,我正在尝试使用“AUTH_ROLES_MAPPING”拆分权限角色,但还没有运气。 How can I do that?我怎样才能做到这一点?

from flask_appbuilder.security.manager import AUTH_OID
from flask_appbuilder.security.manager import AUTH_REMOTE_USER
from flask_appbuilder.security.manager import AUTH_DB
from flask_appbuilder.security.manager import AUTH_LDAP
#AUTH_TYPE = AUTH_LDAP
#AUTH_USER_REGISTRATION = True
#AUTH_USER_REGISTRATION_ROLE = "Public"

#AUTH_LDAP_SERVER = "ldap://10.10.0.50"
#AUTH_LDAP_USE_TLS = False
#AUTH_LDAP_BIND_USER = "CN=Administrator,CN=Users,DC=gru,DC=lab"
#AUTH_LDAP_BIND_PASSWORD = "password"
#AUTH_LDAP_SEARCH = "DC=gru,DC=lab"
#AUTH_LDAP_GROUP_FIELS="CN=linuxadmins,DC=gru,DC=lab"
#AUTH_LDAP_SEARCH = "DC=gru,DC=lab"
#AUTH_LDAP_UID_FIELD = "sAMAccountName"
#AUTH_LDAP_FIRSTNAME_FIELD = "givenName"
#AUTH_LDAP_LASTNAME_FIELD = "sn"

UPDATE -- I've tried "AUTH_TYPE = 1|2", also "AUTH_TYPE = AUTH_DB, AUTH_LDAP".更新——我试过“AUTH_TYPE = 1|2”,也试过“AUTH_TYPE = AUTH_DB,AUTH_LDAP”。 unfortunately no result.不幸的是没有结果。

To use both - LDAP and DB users - you should implement custom Superset security manager which will solve the problem.要同时使用 LDAP 和 DB 用户,您应该实施自定义 Superset 安全管理器来解决问题。

At first, you should create new file, eg my_security_manager.py .首先,您应该创建新文件,例如my_security_manager.py Put these lines into it:将这些行放入其中:

from superset.security import SupersetSecurityManager


class MySecurityManager(SupersetSecurityManager):
    
    def __init__(self, appbuilder):
        super(MySecurityManager, self).__init__(appbuilder)

Secondly, you should let Superset know that you want to use your brand new security manager.其次,您应该让 Superset 知道您想使用全新的安全管理器。 To do so, add these lines to your Superset configuration file ( superset_config.py ):为此,请将这些行添加到您的 Superset 配置文件 ( superset_config.py ):

from my_security_manager import MySecurityManager
CUSTOM_SECURITY_MANAGER = MySecurityManager

Then you can override auth_user_db(username, password) method of your class with your custom authentication logic.然后,您可以使用自定义身份验证逻辑覆盖class 的 auth_user_db(username, password)方法。

Here is additional information on the topic .这是有关该主题的其他信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM