Comment 2 for bug 1212405

Revision history for this message
Xavier Queralt (xqueralt-deactivatedaccount) wrote :

I was able to hunt down the origin of this issue to the fact that we patch django auth middleware's get_user method too late.

It looks like the AuthenticationMiddleware called before loading openstack_auth's urls module (where the patching happens) and this leads to the first request being associated with the original get_user method and crashing if accessing to the user attribute.

This is where the middleware gets patched now:
https://github.com/openstack/django_openstack_auth/blob/master/openstack_auth/urls.py#L5

If instead it is patched from the settings module, the issue is fixed. I don't know if that's the correct place to patch it though.