mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-07 10:03:54 +00:00
add-debug-logs
This commit is contained in:
parent
0666b7a303
commit
0b094bd287
@ -50,6 +50,7 @@ class ShibbolethRemoteUserBackend(RemoteUserBackend):
|
|||||||
object with the given username is not found in the database.
|
object with the given username is not found in the database.
|
||||||
"""
|
"""
|
||||||
if not remote_user:
|
if not remote_user:
|
||||||
|
logger.warning("remote user not found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
remote_user = self.clean_username(remote_user)
|
remote_user = self.clean_username(remote_user)
|
||||||
|
@ -65,12 +65,14 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
|
|||||||
|
|
||||||
# Locate the remote user header.
|
# Locate the remote user header.
|
||||||
# import pprint; pprint.pprint(request.META)
|
# import pprint; pprint.pprint(request.META)
|
||||||
|
logger.info('request header in meta list: %s' % request.META)
|
||||||
try:
|
try:
|
||||||
remote_user = request.META[SHIB_USER_HEADER]
|
remote_user = 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
|
||||||
# AuthenticationMiddleware).
|
# AuthenticationMiddleware).
|
||||||
|
logger.warning('Header %s does not exists in meta.' % SHIB_USER_HEADER)
|
||||||
return
|
return
|
||||||
|
|
||||||
second_uid = request.META.get(SHIB_USER_HEADER_SECOND_UID, '')
|
second_uid = request.META.get(SHIB_USER_HEADER_SECOND_UID, '')
|
||||||
@ -79,6 +81,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
|
|||||||
# getting passed in the headers, then the correct user is already
|
# getting passed in the headers, then the correct user is already
|
||||||
# persisted in the session and we don't need to continue.
|
# persisted in the session and we don't need to continue.
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
logger.info('user is authenticated')
|
||||||
return
|
return
|
||||||
|
|
||||||
# Make sure we have all required Shiboleth elements before proceeding.
|
# Make sure we have all required Shiboleth elements before proceeding.
|
||||||
@ -86,6 +89,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
|
|||||||
# Add parsed attributes to the session.
|
# Add parsed attributes to the session.
|
||||||
request.session['shib'] = shib_meta
|
request.session['shib'] = shib_meta
|
||||||
if error:
|
if error:
|
||||||
|
logger.error("All required Shibboleth elements not found. %s" % shib_meta)
|
||||||
raise ShibbolethValidationError("All required Shibboleth elements"
|
raise ShibbolethValidationError("All required Shibboleth elements"
|
||||||
" not found. %s" % shib_meta)
|
" not found. %s" % shib_meta)
|
||||||
|
|
||||||
@ -96,6 +100,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
|
|||||||
second_uid=second_uid)
|
second_uid=second_uid)
|
||||||
if user:
|
if user:
|
||||||
if not user.is_active:
|
if not user.is_active:
|
||||||
|
logger.warning('user is not activated')
|
||||||
return HttpResponseRedirect(reverse('shib_complete'))
|
return HttpResponseRedirect(reverse('shib_complete'))
|
||||||
|
|
||||||
# User is valid. Set request.user and persist user in the session
|
# User is valid. Set request.user and persist user in the session
|
||||||
|
Loading…
Reference in New Issue
Block a user