def check_basic_auth(req, user, passwd):
    """Checks user authentication using HTTP Basic Auth."""

    auth = req.authorization
    return auth and auth.username == user and auth.password == passwd