kannant-sf opened a new issue, #29505:
URL: https://github.com/apache/superset/issues/29505
### Bug description
We have deployed our apache superset on AWS fargate, we have our internal
dashboards from there we want our users to login hence we have implemented
custom login setup on superset side, i was able to do it, now everything works
fine, but if i navigate to list/users its redirecting me to login screen and
logs in back but getting access denied in right bottom popup, If i revert my
custom login code it works properly am using the same user credentials, not
sure why it behaves differently, attaching my custom login code
`class RemoteUserMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
user = environ.pop('HTTP_USER', None)
environ['REMOTE_USER'] = user
return self.app(environ, start_response)
ADDITIONAL_MIDDLEWARE = [RemoteUserMiddleware]
class CustomRemoteUserView(AuthRemoteUserView):
login_template = ""
@expose("/login/")
def login(self):
logger.info("Using custom security manager")
username = ""
url = ""
if g.user is not None and g.user.is_authenticated:
return redirect(self.appbuilder.get_url_for_index)
def getUserName(user_roles):
return "dummy"
try:
token = "Bearer " + token
response = requests.get(url,
headers={"Tenant_identifier":tenantIdentifier, "Authorization": token})
if response.status_code == 200:
user_data = response.json()
user_roles = user_data['data']['userRoles']
security_manager = self.appbuilder.sm
username=getUserName(user_roles)
logger.info(username)
user = security_manager.find_user(username=username)
logger.info("details")
logger.info(user)
if user is not None:
logger.info("Inside if condition")
login_user(user)
return redirect(self.appbuilder.get_url_for_index)
else:
print('Error:', response.status_code)
logger.warning("User not found")
return redirect('/login/')
except requests.exceptions.RequestException as e:
logger.error('Error:')
return redirect('/login/')
class CustomSecurityManager(SupersetSecurityManager):
authremoteuserview = CustomRemoteUserView
CUSTOM_SECURITY_MANAGER = CustomSecurityManager
AUTH_TYPE = AUTH_REMOTE_USER`
### How to reproduce the bug
1. Implement custom login on
forte-fit/superset/docker/pythonpath_dev/superset_config.py
2. Login using with any admin role credentials
3. Navigate to users/list
### Screenshots/recordings

### Superset version
3.1.3
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### 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.
- [ ] 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]