llama-stack-mirror/tests/unit/server
Derek Higgins c9dfd26385 fix(auth): allow unauthenticated access to health and version endpoints
The AuthenticationMiddleware was blocking all requests without an
Authorization header, including health and version endpoints that are
needed by monitoring tools, load balancers, and Kubernetes probes.

This commit adds a `require_authentication` parameter to the @webmethod
decorator (defaults to True). Endpoints can opt out of authentication by
setting `require_authentication=False`. The /health and /version endpoints
now use this parameter to allow unauthenticated access.

Changes:
- Add `require_authentication` field to WebMethod dataclass
- Update @webmethod decorator to accept `require_authentication` parameter
- Mark /health and /version endpoints with `require_authentication=False`
- Update middleware to check webmethod.require_authentication dynamically

Closes: #3735

Signed-off-by: Derek Higgins <derekh@redhat.com>
2025-10-09 20:14:34 +01:00
..
test_access_control.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
test_auth.py fix(auth): allow unauthenticated access to health and version endpoints 2025-10-09 20:14:34 +01:00
test_auth_github.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
test_cors.py feat: Add CORS configuration support for server (#3201) 2025-08-21 14:23:27 -07:00
test_quota.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
test_replace_env_vars.py fix(env): env var replacement preserve types (#3270) 2025-08-28 17:07:18 +02:00
test_resolver.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00
test_server.py fix: show descriptive MCP server connection errors instead of generic 500s (#3256) 2025-09-04 13:25:02 -07:00
test_sse.py chore(rename): move llama_stack.distribution to llama_stack.core (#2975) 2025-07-30 23:30:53 -07:00