diff --git a/cas/middleware.py b/cas/middleware.py index 771a1d1..e46a27b 100644 --- a/cas/middleware.py +++ b/cas/middleware.py @@ -5,6 +5,15 @@ except ImportError: from urllib.parse import urlencode + +MIDDLEWARE_BASE = None + +try: + from django.utils.deprecation import MiddlewareMixin + MIDDLEWARE_BASE = MiddlewareMixin +except ImportError: + MIDDLEWARE_BASE = object + from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth import logout as do_logout @@ -19,7 +28,7 @@ __all__ = ['CASMiddleware'] -class CASMiddleware(object): +class CASMiddleware(MIDDLEWARE_BASE): """ Middleware that allows CAS authentication on admin pages """ @@ -81,7 +90,7 @@ def process_exception(self, request, exception): return None -class ProxyMiddleware(object): +class ProxyMiddleware(MIDDLEWARE_BASE): # Middleware used to "fake" the django app that it lives at the Proxy Domain def process_request(self, request):