Skip to content

Commit

Permalink
Should fix #406
Browse files Browse the repository at this point in the history
Should now work with old-style Middleware and the Django 1.10 new style
  • Loading branch information
bastbnl authored and synasius committed Nov 17, 2016
1 parent 34a5263 commit 911f7b8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion oauth2_provider/middleware.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
from django.contrib.auth import authenticate
from django.utils.cache import patch_vary_headers

# bastb Django 1.10 has updated Middleware. This code imports the Mixin required to get old-style
# middleware working again
# More?
# https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
try:
from django.utils.deprecation import MiddlewareMixin
middleware_parent_class = MiddlewareMixin
except ImportError:
middleware_parent_class = object

class OAuth2TokenMiddleware(object):

class OAuth2TokenMiddleware(middleware_parent_class):
"""
Middleware for OAuth2 user authentication
Expand Down

0 comments on commit 911f7b8

Please sign in to comment.