Skip to content

Commit

Permalink
New version of django-chamber
Browse files Browse the repository at this point in the history
  • Loading branch information
matllubos committed May 6, 2018
1 parent 8f3b473 commit 6df7985
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions chamber/multidomains/auth/middleware.py
@@ -1,11 +1,10 @@
from django.utils.functional import SimpleLazyObject

from is_core.config import settings as is_core_settings # pylint: disable=E0401
from is_core.auth_token import utils # pylint: disable=E0401
from is_core.auth_token.middleware import TokenAuthenticationMiddlewares, get_user # pylint: disable=E0401
from is_core.auth_token.models import Token # pylint: disable=E0401
from is_core.auth_token.utils import dont_enforce_csrf_checks # pylint: disable=E0401
from is_core.utils import header_name_to_django # pylint: disable=E0401
from auth_token import utils # pylint: disable=E0401
from auth_token.config import settings as auth_token_settings # pylint: disable=E0401
from auth_token.middleware import TokenAuthenticationMiddleware, get_user # pylint: disable=E0401
from auth_token.models import Token # pylint: disable=E0401
from auth_token.utils import dont_enforce_csrf_checks, header_name_to_django # pylint: disable=E0401

from chamber import config
from chamber.shortcuts import get_object_or_none
Expand All @@ -16,7 +15,7 @@ def get_token(request):
Returns the token model instance associated with the given request token key.
If no user is retrieved AnonymousToken is returned.
"""
if (not request.META.get(header_name_to_django(is_core_settings.AUTH_HEADER_NAME)) and
if (not request.META.get(header_name_to_django(auth_token_settings.HEADER_NAME)) and
config.CHAMBER_MULTIDOMAINS_OVERTAKER_AUTH_COOKIE_NAME):
ovetaker_auth_token = request.COOKIES.get(config.CHAMBER_MULTIDOMAINS_OVERTAKER_AUTH_COOKIE_NAME)
token = get_object_or_none(Token, key=ovetaker_auth_token, is_active=True)
Expand All @@ -26,7 +25,7 @@ def get_token(request):
return utils.get_token(request)


class MultiDomainsTokenAuthenticationMiddleware(TokenAuthenticationMiddlewares):
class MultiDomainsTokenAuthenticationMiddleware(TokenAuthenticationMiddleware):

def process_request(self, request):
"""
Expand Down

0 comments on commit 6df7985

Please sign in to comment.