From 20492577f0e3c2b5505fa0c23d02358d63bc60ea Mon Sep 17 00:00:00 2001 From: Davis Muro Date: Mon, 21 Nov 2022 13:02:50 +0300 Subject: [PATCH] Use correct header name --- kpi/utils/ona_authentication.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kpi/utils/ona_authentication.py b/kpi/utils/ona_authentication.py index edfdade8cb..387f91bff0 100644 --- a/kpi/utils/ona_authentication.py +++ b/kpi/utils/ona_authentication.py @@ -2,19 +2,16 @@ from django.conf import settings from django.contrib.auth.models import User from django.core.signing import BadSignature -from django.utils.translation import ugettext as _ -from django.utils import timezone from django.shortcuts import get_object_or_404 +from django.utils import timezone +from django.utils.translation import ugettext as _ from rest_framework import exceptions -from rest_framework.authentication import ( - BaseAuthentication -) +from rest_framework.authentication import BaseAuthentication from rest_framework.authtoken.models import Token from kpi.utils.permissions import grant_default_model_level_perms - def get_api_token(json_web_token): """Get API Token from JSON Web Token""" # having the JWT variables here allows the values to be mocked easily as @@ -43,7 +40,7 @@ class JWTAuthentication(BaseAuthentication): def authenticate(self, request): cookie_jwt = request.COOKIES.get(settings.KPI_COOKIE_NAME) - auth_header = request.META.get("X-ONADATA-KOBOCAT-AUTH") + auth_header = request.META.get("HTTP_X_ONADATA_KOBOCAT_AUTH") if cookie_jwt: api_token = get_api_token(cookie_jwt) elif auth_header: