For simple cases, add the below snippet to superset_config.py
as mentioned here:
class RemoteUserMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
user = environ.pop('HTTP_X_PROXY_REMOTE_USER', None)
environ['REMOTE_USER'] = user
return self.app(environ, start_response)
ADDITIONAL_MIDDLEWARE = [RemoteUserMiddleware, ]
AUTH_TYPE = AUTH_REMOTE_USER
AUTH_USER_REGISTRATION = True
and configure the reverse proxy to add the username (or email) to a header named X-PROXY-REMOTE-USER
(without the HTTP
). Enabling AUTH_USER_REGISTRATION
is important so that the account gets created automatically if it doesn't exist.
This will call the AuthRemoteUserView view, which in turn calls auth_user_remote_user to find and create a user if it doesn't exist.
If you want to customize this to add email, usernames, and possibly do rbac based on groups, you can extend the above view like so:
class CustomRemoteUserView(AuthRemoteUserView):
[...]
class CustomSecurityManager(SupersetSecurityManager):
authremoteuserview = CustomRemoteUserView
CUSTOM_SECURITY_MANAGER = CustomSecurityManager