(check, realm="private", text="Access denied")
return decorator
Callback decorator to require HTTP auth (basic).
        TODO: Add route(check_auth=...) parameter.
Callback decorator to require HTTP auth (basic).
        TODO: Add route(check_auth=...) parameter.
Callback decorator to require HTTP auth ( basic ) . TODO : Add route ( check_auth = ... ) parameter .
def auth_basic(check, realm="private", text="Access denied"):
    ''' Callback decorator to require HTTP auth (basic).
        TODO: Add route(check_auth=...) parameter. '''
    def decorator(func):
        def wrapper(*a, **ka):
            user, password = request.auth or (None, None)
            if user is None or not check(user, password):
                err = HTTPError(401, text)
                err.add_header('WWW-Authenticate', 'Basic realm="%s"' % realm)
                return err
            return func(*a, **ka)
        return wrapper
    return decorator
def auth_basic ( check , realm = "private" , text = "Access denied" ) : def decorator ( func ) : def wrapper ( * a , * * ka ) : user , password = request . auth or ( None , None ) if user is None or not check ( user , password ) : err = HTTPError ( 401 , text ) err . add_header ( 'WWW-Authenticate' , 'Basic realm="%s"' % realm ) return err return func ( * a , * * ka ) return wrapper return decorator