Module Expr Str Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body If Call AttributeLoad NameLoad attr NameLoad body Return Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad NameLoad decorator_list Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Str Str Str Str Str Str Str For NameStore NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If UnaryOpNot NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr NameLoad Raise Call NameLoad Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Yield Call NameLoad NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Raise Call NameLoad Num NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Yield NameLoad Raise Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam defaults body FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Yield Call NameLoad NameLoad NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Raise Call NameLoad Num NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Yield NameLoad Raise Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr Return NameLoad decorator_list Return NameLoad decorator_list
N/A N/A 
Provides a auth_required decorator to check a request is authenticated,
and an authorised decorator to check a request is authorised
 N/A functools N/A inspect N/A logging tornado gen tornado.concurrent Future exceptions HTTPError auth_required N/A N/A validator N/A N/A N/A Decorate a RequestHandler or method to require that a request is authenticated

    If decorating a coroutine make sure coroutine decorator is first.
    eg.::

        class Handler(tornado.web.RequestHandler):

            @auth_required(validator)
            @coroutine
            def get(self):
                pass

    :param validator: a coroutine that will validate the token and return True/False
     _auth_decorator N/A N/A handler N/A N/A N/A N/A N/A inspect isclass handler N/A N/A N/A _wrap_class handler validator N/A N/A _auth_required handler validator N/A N/A _auth_decorator N/A _wrap_class N/A N/A request_handler validator N/A N/A N/A Decorate each HTTP verb method to check if the request is authenticated

    :param request_handler: a tornado.web.RequestHandler instance
     N/A METHODS N/A get post put head options delete patch N/A name METHODS N/A N/A method N/A getattr request_handler name N/A N/A setattr request_handler name N/A _auth_required method validator N/A request_handler N/A _get_token N/A N/A request N/A N/A N/A 
    Gets authentication token from request header
    Will raise 401 error if token not found
    :return token: an authorization token.
     N/A token N/A N/A N/A request headers get Authorization N/A N/A token N/A N/A message Token not in Authorization header N/A N/A N/A logging warning message N/A N/A HTTPError 401 message N/A token N/A _auth_required N/A N/A method validator N/A N/A N/A Decorate a HTTP verb method and check the request is authenticated

    :param method: a tornado.web.RequestHandler method
    :param validator: a token validation coroutine, that should return
    True/False depending if token is or is not valid
     wrapper N/A N/A self N/A args kwargs N/A N/A token N/A _get_token N/A self request N/A valid_token N/A N/A validator token N/A N/A valid_token N/A N/A message N/A N/A Invalid token: {} format token N/A N/A N/A logging warning message N/A N/A HTTPError 401 message N/A result N/A method self args kwargs N/A N/A isinstance result Future N/A N/A result N/A result N/A N/A N/A gen Return result N/A N/A gen coroutine N/A N/A functools wraps method N/A wrapper N/A authorized N/A N/A validator N/A N/A N/A Decorate a RequestHandler or method to require that a request is authorized

    If decorating a coroutine make sure coroutine decorator is first.
    eg.::

        class Handler(tornado.web.RequestHandler):

            @authorized(validator)
            @coroutine
            def get(self):
                pass

    :param validator: a coroutine that will authorize the user associated with the token and return True/False
     _authorized_decorator N/A N/A method N/A N/A wrapper N/A N/A self N/A args kwargs N/A N/A token N/A _get_token N/A self request N/A authorized N/A N/A validator token kwargs N/A N/A authorized N/A N/A message N/A N/A Token is not authorised for this action: {} format token N/A N/A N/A logging warning message N/A N/A HTTPError 403 message N/A result N/A method self args kwargs N/A N/A isinstance result Future N/A N/A result N/A result N/A N/A N/A gen Return result N/A N/A gen coroutine N/A wrapper N/A N/A _authorized_decorator N/A