Explorar o código

HUE-8498 [core] Add whitelist to Spnego middleware

Ying Chen %!s(int64=7) %!d(string=hai) anos
pai
achega
09dc8598b2
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      desktop/core/src/desktop/middleware.py

+ 5 - 1
desktop/core/src/desktop/middleware.py

@@ -566,9 +566,13 @@ class SpnegoMiddleware(object):
       Negotiate. This will cause the browser to re-try the request with the
       AUTHORIZATION header set.
     """
+    view_func = resolve(request.path)[0]
+    if view_func in DJANGO_VIEW_AUTH_WHITELIST:
+      return
+
     # AuthenticationMiddleware is required so that request.user exists.
     if not hasattr(request, 'user'):
-      raise ImproperlyConfigured(
+      raise exceptions.ImproperlyConfigured(
         "The Django remote user auth middleware requires the"
         " authentication middleware to be installed.  Edit your"
         " MIDDLEWARE_CLASSES setting to insert"