def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) if not Authenticator.is_authenticated(handler.request.path, handler.request.method, helper): helper.header(error_header, error_message) helper.error(403) else: f(*args, **kw)
def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) if not users.is_current_user_admin(): helper.header(error_header, error_msg) helper.error(403) else: f(*args, **kw)
def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) if not Authenticator.is_authenticated( handler.request.path, handler.request.method, helper): helper.header(error_header, error_message) helper.error(403) else: f(*args, **kw)
def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) user = users.get_current_user() if not user: helper.header(error_header, error_msg) helper.error(403) elif not emails or (not user.email() in emails): helper.header(error_header, "unauthorized-user") helper.error(403) else: f(*args, **kw)
def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) auth_header = handler.request.headers.get(Headers.AUTHORIZATION, "") code, headers, user = DigestAuth(realm, users).authenticate(handler.request.method, handler.request.path, auth_header) if code >= 400 and code < 499: for k, v in headers: helper.header(k, v) helper.error(code) else: kw['username'] = user return f(*args, **kw)
def args_call(*args, **kw): handler = args[0] helper = RequestHelper(handler) auth_header = handler.request.headers.get(Headers.AUTHORIZATION, "") code, headers, user = DigestAuth(realm, users).authenticate( handler.request.method, handler.request.path, auth_header) if code >= 400 and code < 499: for k, v in headers: helper.header(k, v) helper.error(code) else: kw['username'] = user return f(*args, **kw)