async def authorize(request, context):
    needs_authentication = False
    for action in context.actions:
        if action == "IntrospectionQuery":
            break
        if action not in []:
            needs_authentication = True

    user = None
    if needs_authentication is True:
        authentication_token = request.headers.get("Authorization")
        if not authentication_token:
            raise Exception("No token in request!")
        user = User.authenticate(token=authentication_token)
    return user