1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 19:29:56 +00:00

[shibboleth] Modify user creation

This commit is contained in:
zhengxie
2014-12-17 14:40:16 +08:00
parent c914fe30c5
commit 61b41e8fea
2 changed files with 14 additions and 8 deletions

View File

@@ -1,9 +1,10 @@
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from shibboleth.app_settings import SHIB_ATTRIBUTE_MAP, LOGOUT_SESSION_KEY
from seahub import auth
class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
"""
Authentication Middleware for use with Shibboleth. Uses the recommended pattern
@@ -39,7 +40,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
# getting passed in the headers, then the correct user is already
# persisted in the session and we don't need to continue.
if request.user.is_authenticated():
if request.user.username == self.clean_username(username, request):
if request.user.username == username:
return
# Make sure we have all required Shiboleth elements before proceeding.