Skip to content

Commit

Permalink
Use correct header name
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Nov 21, 2022
1 parent e96106d commit 2049257
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions kpi/utils/ona_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2049257

Please sign in to comment.