1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

do not re-create django session on every request

* The django middleware call stack behavior is changed by DRF. As a
result, during the process_request in sso/middlware.py request.user
is not set as you would expect it to be set from the middleware
django.contrib.auth.middleware.AuthenticationMiddleware
This commit is contained in:
Chris Meyers 2017-08-21 11:19:52 -04:00
parent 2bccb5e753
commit 45813bea16

View File

@ -53,7 +53,7 @@ class SocialAuthMiddleware(SocialAuthExceptionMiddleware):
if not auth_token and request.user and request.user.is_authenticated():
logout(request)
elif auth_token and request.user != auth_token.user:
elif auth_token and request.user.is_anonymous is False and request.user != auth_token.user:
logout(request)
auth_token.user.backend = ''
login(request, auth_token.user)