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 2018/05/15 06:31:59 UTC

[GitHub] Maxwell2022 commented on issue #2580: Question: How to auto login (bypass) login page?

Maxwell2022 commented on issue #2580: Question: How to auto login (bypass) login page?
URL: https://github.com/apache/incubator-superset/issues/2580#issuecomment-389057992
 
 
   You need 3 things in your `superset_config.py`:
   
   1. A custom REMOTE_USER authenticator
   2. Update the security manager to point to a new one that have you custom authenticator
   3. Set the auth type to AUTH_REMOTE_USER
   
   In a nutshel:
   
   ```python
   # Import some libraries that are required
   from flask_appbuilder.security.views import expose
   from flask_appbuilder.security.sqla.manager import SecurityManager
   from flask_appbuilder.security.manager import BaseSecurityManager
   from flask_appbuilder.security.manager import AUTH_REMOTE_USER
   
   # Create a custom view to authenticate the user
   AuthRemoteUserView=BaseSecurityManager.authremoteuserview
   class AirbnbAuthRemoteUserView(AuthRemoteUserView):
       @expose('/login/')
       def login(self):
         print("This is LOGIN")
         return ("This is the response from your custom authenticator")
   
   
   # Create a custom Security manager that override the authremoteuserview with the one I've created
   class CustomSecurityManager(SecurityManager):
       authremoteuserview = AirbnbAuthRemoteUserView
   
   # Use my custom authenticator
   CUSTOM_SECURITY_MANAGER = CustomSecurityManager
   
   # User remote authentication
   AUTH_TYPE = AUTH_REMOTE_USER
   ```
   
   I use docker to do all my test and found that running superset with `gunicorn` is much easier because I can reload the server as soon as I update the configuration file:
   
   ```shell
   # Start the docker container
   # I'm using 0.23.3 because I had issue with more recent versions
   
   docker run -it -v $(pwd)/config:/etc/superset -v $(pwd)/SQLlite:/var/lib/superset -p 8088:6000 --entrypoint sh --user root amancevice/superset:0.23.3
   
   # Then inside the container start gunicorn
   gunicorn -w 1 -k gevent --timeout 120 \
     --reload \
     --reload-extra-file /etc/superset/superset_config.py \
     -b  0.0.0.0:6000 --limit-request-line 0 --limit-request-field_size 0 superset:app
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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