mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that users should be able to modify the REMOTE_USER environment
variable as per their environment by introducing the new config parameter WEBSERVER_REMOTE_USER. Fixes #6953
This commit is contained in:
committed by
Akshay Joshi
parent
9479f0e632
commit
d4697e8f1c
@@ -736,6 +736,13 @@ OAUTH2_AUTO_CREATE_USER = True
|
||||
|
||||
WEBSERVER_AUTO_CREATE_USER = True
|
||||
|
||||
# REMOTE_USER variable will be used to check the environment variable
|
||||
# is set or not first, if not available,
|
||||
# request header will be checked for the same.
|
||||
# Possible values: REMOTE_USER, HTTP_X_FORWARDED_USER, X-Forwarded-User
|
||||
|
||||
WEBSERVER_REMOTE_USER = 'REMOTE_USER'
|
||||
|
||||
##########################################################################
|
||||
# PSQL tool settings
|
||||
##########################################################################
|
||||
|
||||
@@ -77,7 +77,11 @@ class WebserverAuthentication(BaseAuthentication):
|
||||
return True
|
||||
|
||||
def get_user(self):
|
||||
return request.environ.get('REMOTE_USER')
|
||||
username = request.environ.get(config.WEBSERVER_REMOTE_USER)
|
||||
if not username:
|
||||
# One more try to get the Remote User from the hearders
|
||||
username = request.headers.get(config.WEBSERVER_REMOTE_USER)
|
||||
return username
|
||||
|
||||
def authenticate(self, form):
|
||||
username = self.get_user()
|
||||
|
||||
Reference in New Issue
Block a user