auth: add integration tests for security best practices conformance
This PR adds integration tests to catch Security Best Practices 2.2 Token Passthrough.
Add HTTP middleware integration tests to validate MCP Security Best Practices conformance:
- Invalid tokens (e.g., wrong audience/unknown issuer) return
401, setWWW-Authenticate, and do not invoke the handler - Missing required scopes, return
403and setWWW-Authenticate. Valid tokens succeed (200) - No token passthrough: downstream requests do not receive the client Authorization header
Contributes towards #12345
No objections, I just want to read the doc first. It may be a couple of days.
@samthanawalla, could you please help with this review?
I don't understand something. The spec says "MCP servers MUST NOT accept any tokens that were not explicitly issued for the MCP server." But the decision on whether to accept the token or not is left up to the TokenVerifier and is out of scope for our SDK. So how can we test this behavior?