Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/mcp/server/auth/middleware/bearer_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def __init__(
self.provider = provider

async def authenticate(self, conn: HTTPConnection):
auth_header = conn.headers.get("Authorization")
auth_header = conn.headers.get("Authorization") or conn.headers.get(
"authorization"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auth_header = conn.headers.get("Authorization") or conn.headers.get(
"authorization"
)
auth_header = next(
(conn.headers.get(key) for key in conn.headers if key.lower() == "authorization"),
None
)

if not auth_header or not auth_header.startswith("Bearer "):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would Bearer have the same issue?

return None

Expand Down
Loading