diff --git a/shibboleth/app_settings.py b/shibboleth/app_settings.py index 8809e4d..6a7c349 100755 --- a/shibboleth/app_settings.py +++ b/shibboleth/app_settings.py @@ -5,9 +5,11 @@ #At a minimum you will need username, default_shib_attributes = { "REMOTE_USER": (True, "username"), -} +} +default_shib_username_attribute = 'REMOTE_USER' SHIB_ATTRIBUTE_MAP = getattr(settings, 'SHIBBOLETH_ATTRIBUTE_MAP', default_shib_attributes) +SHIB_USERNAME_ATTRIBUTE = getattr(settings, 'SHIBBOLETH_USERNAME_ATTRIBUTE', default_shib_username_attribute) #Set to true if you are testing and want to insert sample headers. SHIB_MOCK_HEADERS = getattr(settings, 'SHIBBOLETH_MOCK_HEADERS', False) diff --git a/shibboleth/middleware.py b/shibboleth/middleware.py index e271492..6bacbac 100755 --- a/shibboleth/middleware.py +++ b/shibboleth/middleware.py @@ -4,10 +4,11 @@ from django.core.exceptions import ImproperlyConfigured import re -from shibboleth.app_settings import SHIB_ATTRIBUTE_MAP, GROUP_ATTRIBUTES, GROUP_DELIMITERS +from shibboleth.app_settings import SHIB_ATTRIBUTE_MAP, SHIB_USERNAME_ATTRIBUTE, GROUP_ATTRIBUTES, GROUP_DELIMITERS class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware): + header = SHIB_USERNAME_ATTRIBUTE """ Authentication Middleware for use with Shibboleth. Uses the recommended pattern for remote authentication from: http://code.djangoproject.com/svn/django/tags/releases/1.3/django/contrib/auth/middleware.py