Beispiel #1
0
 def wrapper(request, *args, **kwargs):
     auth = json.loads(request.data.decode()).get('payload')
     if auth:
         token_tmp = AuthToken.select().filter(AuthToken.access_token == auth.get('accessToken')).first()
         if token_tmp:
             if token_tmp.is_access_token_expired():
                 return HttpResponse('access_token_expired', status=401)
             else:
                 return fn(request, *args, **kwargs)
         else:
             return HttpResponse('access_token_invalid', status=401)
     else:
         return HttpResponse('Unauthorized', status=401)