def auth_basic(check, realm="<STR_LIT>", text="<STR_LIT>"):
def decorator(func):<EOL><INDENT>def wrapper(*a, **ka):<EOL><INDENT>user, password = request.auth or (None, None)<EOL>if user is None or not check(user, password):<EOL><INDENT>response.headers['<STR_LIT>'] = '<STR_LIT>' % realm<EOL>return HTTPError(<NUM_LIT>, text)<EOL><DEDENT>return func(*a, **ka)<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Callback decorator to require HTTP auth (basic).
        TODO: Add route(check_auth=...) parameter.