mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-17 15:53:28 +00:00
Environment variable for shibboleth user name can be changed. The default is REMOTE_USER which is provided by e.g. apache modules.
This commit is contained in:
@@ -11,6 +11,8 @@ SHIB_ATTRIBUTE_MAP = getattr(settings, 'SHIBBOLETH_ATTRIBUTE_MAP', default_shib_
|
|||||||
#Set to true if you are testing and want to insert sample headers.
|
#Set to true if you are testing and want to insert sample headers.
|
||||||
SHIB_MOCK_HEADERS = getattr(settings, 'SHIBBOLETH_MOCK_HEADERS', False)
|
SHIB_MOCK_HEADERS = getattr(settings, 'SHIBBOLETH_MOCK_HEADERS', False)
|
||||||
|
|
||||||
|
SHIB_USER_HEADER = getattr(settings, 'SHIBBOLETH_USER_HEADER', "REMOTE_USER")
|
||||||
|
|
||||||
LOGIN_URL = getattr(settings, 'LOGIN_URL', None)
|
LOGIN_URL = getattr(settings, 'LOGIN_URL', None)
|
||||||
|
|
||||||
if not LOGIN_URL:
|
if not LOGIN_URL:
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
from django.contrib.auth.middleware import RemoteUserMiddleware
|
from django.contrib.auth.middleware import RemoteUserMiddleware
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
from shibboleth.app_settings import SHIB_ATTRIBUTE_MAP, LOGOUT_SESSION_KEY
|
from shibboleth.app_settings import SHIB_ATTRIBUTE_MAP, LOGOUT_SESSION_KEY, SHIB_USER_HEADER
|
||||||
|
|
||||||
from seahub import auth
|
from seahub import auth
|
||||||
from seahub.api2.models import Token
|
from seahub.api2.models import Token
|
||||||
@@ -35,7 +35,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
|
|||||||
|
|
||||||
#Locate the remote user header.
|
#Locate the remote user header.
|
||||||
try:
|
try:
|
||||||
username = request.META[self.header]
|
username = request.META[SHIB_USER_HEADER]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# If specified header doesn't exist then return (leaving
|
# If specified header doesn't exist then return (leaving
|
||||||
# request.user set to AnonymousUser by the
|
# request.user set to AnonymousUser by the
|
||||||
|
Reference in New Issue
Block a user