A2aEngine.Auth.Localhost (a2a_engine v0.1.0)

Copy Markdown View Source

Same-host bypass. Accepts any request whose peer socket is a loopback address. Intended for the BeamNative transport and for HTTP deployments where the port is only bound to 127.0.0.1.

Options

  • :allow_beam_native (default true) — :beam peers are always loopback-equivalent (same node or clustered connected node).
  • :extra_allowed_ips — additional IP addresses to treat as loopback (tuples like {192, 168, 1, 10}). Useful for trusted LAN hosts.

Behaviour

  • peer: :local or {:beam, _} → accepted.
  • peer: {:tcp, {127, 0, 0, 1}} or {0, 0, 0, 0, 0, 0, 0, 1} → accepted.
  • Anything else → :unauthenticated.

Returns %{scheme: :localhost, principal: nil, extra: %{peer: <info>}}.