Source code for cdh.rest.server.authenticators

from rest_framework import authentication

from .settings import USER_MODEL
from .token import JwtToken


[docs]class JwtAuthentication(authentication.TokenAuthentication): keyword = "Bearer"
[docs] def authenticate_credentials(self, key): decoded = JwtToken.validate_token(key) user = USER_MODEL.objects.get(pk=decoded['pk']) user.is_authenticated = True return (user, decoded)