def has_permission(self, request, view):
        token = JSONWebTokenAuthentication.get_token_from_request(request)

        # Don't check the blacklist for requests with no token.
        if token is None:
            return True

        # The token should already be validated before we call this.
        payload = jwt_decode(token, None, verify=False)
        return not BlacklistedToken.is_blocked(token, payload)
Example #2
0
 def has_permission(self, request, view):
     return not BlacklistedToken.objects.filter(
         token=JSONWebTokenAuthentication.get_token_from_request(
             request)).exists()