You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/17 09:33:09 UTC

[GitHub] [superset] hsnotebook edited a comment on issue #2580: Question: How to auto login (bypass) login page?

hsnotebook edited a comment on issue #2580:
URL: https://github.com/apache/superset/issues/2580#issuecomment-900142885


   Try this in superset_config.py:
   
       from flask_appbuilder.security.views import expose
       from superset.security import SupersetSecurityManager
       from flask_appbuilder.security.manager import BaseSecurityManager
       from flask_appbuilder.security.manager import AUTH_REMOTE_USER
       from flask import  redirect
       from flask_login import login_user
       
       # Create a custom view to authenticate the user
       AuthRemoteUserView=BaseSecurityManager.authremoteuserview
       class AirbnbAuthRemoteUserView(AuthRemoteUserView):
           @expose('/login/')
           def login(self):
             user = self.appbuilder.sm.auth_user_db("admin", "admin")
             login_user(user, remember=False)
             return redirect(self.appbuilder.get_url_for_index)
       
       
       # Create a custom Security manager that override the authremoteuserview with the one I've created
       class CustomSecurityManager(SupersetSecurityManager):
           authremoteuserview = AirbnbAuthRemoteUserView
       
       # Use my custom authenticator
       CUSTOM_SECURITY_MANAGER = CustomSecurityManager
       
       # User remote authentication
       AUTH_TYPE = AUTH_REMOTE_USER


-- 
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