You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2026/05/02 03:14:22 UTC
Re: [D] How to customize authentication in version 6 [superset]
GitHub user dosubot[bot] edited a comment on the discussion: How to customize authentication in version 6
<!-- Answer -->
Your approach with `authremoteuserview` should still work in v6, but there are some important changes you'll need to make:
**Key breaking change:** In v6, `get_session` was replaced with `session` ([PR #35290](https://github.com/apache/superset/pull/35290)). This is likely the cause of your issues.
Here's a working example for v6:
```python
from superset.security import SupersetSecurityManager
from flask_appbuilder.security.views import AuthRemoteUserView
from flask import request, redirect
from flask_login import login_user
class CustomAuthRemoteUserView(AuthRemoteUserView):
@expose('/login/')
def login(self):
remote_user = request.environ.get('REMOTE_USER')
if not remote_user:
return redirect('/login')
user = self.appbuilder.sm.get_user_by_username(remote_user)
if not user:
first_name = request.environ.get('FIRST_NAME', '')
last_name = request.environ.get('LAST_NAME', '')
roles_str = request.environ.get('ROLES', 'Public')
roles = [self.appbuilder.sm.find_role(r.strip())
for r in roles_str.split(',') if r.strip()]
user = self.appbuilder.sm.add_user(
username=remote_user,
first_name=first_name,
last_name=last_name,
email=f"{remote_user}@example.com",
role=roles or [self.appbuilder.sm.find_role('Public')]
)
# Changed from get_session to session in v6
self.appbuilder.sm.session.commit()
login_user(user, remember=False)
return redirect(self.appbuilder.get_url_for_index)
class CustomSecurityManager(SupersetSecurityManager):
authremoteuserview = CustomAuthRemoteUserView
```
**Important notes:**
- [AuthRemoteUserView still exists](https://github.com/apache/superset/discussions/36446) but now only affects backend logic — the login UI is React-based in v6 ([discussion](https://github.com/apache/superset/discussions/37057#discussioncomment-15474121))
- Your `CUSTOM_SECURITY_MANAGER` must inherit from `SupersetSecurityManager` (not FAB's SecurityManager)
- [Multiple users have reported AUTH_REMOTE_USER issues after upgrading](https://github.com/apache/superset/discussions/36446), so double-check that your middleware is properly setting `environ['REMOTE_USER']`
Your `superset_config.py` should include:
```python
from flask_appbuilder.security.manager import AUTH_REMOTE_USER
AUTH_TYPE = AUTH_REMOTE_USER
CUSTOM_SECURITY_MANAGER = CustomSecurityManager
ADDITIONAL_MIDDLEWARE = [YourCustomMiddleware]
```
What specific error are you seeing when it doesn't work?
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=419b0db3-bec8-43cf-a994-036f18dc8195) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/38199#discussioncomment-15902093
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org