def config_basic(*, allow='work/basic_auth.cdv', engine="auto", optional=False):
"""
Register a basic authentication challenge using username/password pairs from a CDV.
Username is the key, password is the value under 'b64' (base64-encoded).
- If optional=True, failure does not block unless strict=True.
"""
required = not optional
challenge_fn = _basic_auth_challenge(allow, engine)
_challenges.append(Challenge(challenge_fn, required=required, name="basic_auth"))
typ = "REQUIRED" if required else "OPTIONAL"
gw.info(f"[auth] Registered {typ} basic auth challenge: allow='{allow}' engine='{engine}'")