瀏覽代碼

HUE-8498 [core] Add whitelist to Spnego middleware

Ying Chen 7 年之前
父節點
當前提交
09dc8598b2
共有 1 個文件被更改,包括 5 次插入1 次删除
  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
       Negotiate. This will cause the browser to re-try the request with the
       AUTHORIZATION header set.
       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.
     # AuthenticationMiddleware is required so that request.user exists.
     if not hasattr(request, 'user'):
     if not hasattr(request, 'user'):
-      raise ImproperlyConfigured(
+      raise exceptions.ImproperlyConfigured(
         "The Django remote user auth middleware requires the"
         "The Django remote user auth middleware requires the"
         " authentication middleware to be installed.  Edit your"
         " authentication middleware to be installed.  Edit your"
         " MIDDLEWARE_CLASSES setting to insert"
         " MIDDLEWARE_CLASSES setting to insert"