You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "iRoot13x18 (via GitHub)" <gi...@apache.org> on 2024/05/10 10:18:25 UTC

[I] PROBLEMS WHEN LINKING LDAP [superset]

iRoot13x18 opened a new issue, #28427:
URL: https://github.com/apache/superset/issues/28427

   ### Bug description
   
   I need to link LDAP to my superset and it is giving me error when connecting, I have verified that the LDAP credentials are correct. I have based on these two configuration files.
   
   ### How to reproduce the bug
   
   1- go to PYTHONPATH
   
   2-edit superset_config.py file and put the relevant configuration for LDAP, in particular this was this
   import os
   from superset.security import SupersetSecurityManager
   from flask_appbuilder.security.manager import AUTH_DB,AUTH_LDAP
   from custom_security_manager import CustomSecurityManager
   
   AUTH_TYPE = AUTH_LDAP 
   AUTH_USER_REGISTRATION = True
   AUTH_USER_REGISTRATION_ROLE = "Public" 
   AUTH_LDAP_SERVER = "ldaps://server.yourdomain.com:636"
   AUTH_LDAP_USE_TLS = False
   AUTH_LDAP_BIND_USER = "cn=mycn,ou=myou,ou=myou,dc=mydc,dc=com"
   AUTH_LDAP_BIND_PASSWORD = "password"
   AUTH_LDAP_SEARCH = "DC=your_domain,DC=com,"
   AUTH_LDAP_UID_FIELD = "sAMAccountName"
   AUTH_LDAP_ALLOW_SELF_SIGNED=True
   AUTH_LDAP_APPEND_DOMAIN=False
   AUTH_LDAP_FIRSTNAME_FIELD="givenName"
   AUTH_LDAP_LASTNAME_FIELD="sn"
   AUTH_LDAP_USE_TLS=False
   AUTH_USER_REGISTRATION=True
   
   CUSTOM_SECURITY_MANAGER = CustomSecurityManager
   
   3-create and modify the custom_security_manager.py file in PYTHONPATH
   from superset.security import SupersetSecurityManager
   from flask_appbuilder.security.views import AuthLDAPView
   from flask_appbuilder.security.views import expose
   from flask import g, redirect, flash
   from flask_appbuilder.security.forms import LoginForm_db
   from flask_login import login_user
   from flask_appbuilder._compat import as_unicode
   
   class AuthLocalAndLDAPView(AuthLDAPView):
       @expose("/login/", methods=["GET", "POST"])
       def login(self):
           if g.user is not None and g.user.is_authenticated:
               return redirect(self.appbuilder.get_url_for_index)
           form = LoginForm_db()
           if form.validate_on_submit():
               user = self.appbuilder.sm.auth_user_ldap(
                   form.username.data, form.password.data
               )
               if not user:
                   user = self.appbuilder.sm.auth_user_db(
                       form.username.data, form.password.data
                   )
               if user:
                   login_user(user, remember=False)
                   return redirect(self.appbuilder.get_url_for_index)
               else:
                   flash(as_unicode(self.invalid_login_message), "warning")
                   return redirect(self.appbuilder.get_url_for_login)
           return self.render_template(
               self.login_template, title=self.title, form=form, appbuilder=self.appbuilder
           )
   
   
   class CustomSecurityManager(SupersetSecurityManager):
       authldapview = AuthLocalAndLDAPView
       def __init__(self, appbuilder):
           super(CustomSecurityManager, self).__init__(appbuilder)
   
   4-restart docker-compose and try logging in with ldap credentials
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   4.0.0
   
   ### Python version
   
   3.10
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   I will leave here the web page on which I based my configuration. 
   https://medium.com/@ozan/configure-ldap-and-local-user-login-on-superset-69fa4df4ee24
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PROBLEMS WHEN LINKING LDAP [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #28427:
URL: https://github.com/apache/superset/issues/28427#issuecomment-2104349734

   <!-- Greeting -->
   Hello @iRoot13x18! I'm [Dosu](https://dosu.dev), a bot here to assist with solving bugs, answering questions, and helping you become a contributor to this project. I'm here to provide support while you wait for a human maintainer. Let's dive into your issue with LDAP linkage in Superset and see how we can resolve it.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PROBLEMS WHEN LINKING LDAP [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #28427: PROBLEMS WHEN LINKING LDAP
URL: https://github.com/apache/superset/issues/28427


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] PROBLEMS WHEN LINKING LDAP [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #28427:
URL: https://github.com/apache/superset/issues/28427#issuecomment-2737740029

   Closing this as stale since it's been upward of a year since a comment (including any response to the bot's suggestions). If you want, we can move this to a Q&A/Help discussion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org