We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 993457b commit a855877Copy full SHA for a855877
src/mcp/server/auth/middleware/bearer_auth.py
@@ -41,11 +41,8 @@ def __init__(
41
self.provider = provider
42
43
async def authenticate(self, conn: HTTPConnection):
44
- if "Authorization" not in conn.headers:
45
- return None
46
-
47
- auth_header = conn.headers["Authorization"]
48
- if not auth_header.startswith("Bearer "):
+ auth_header = conn.headers.get("Authorization")
+ if not auth_header or not auth_header.startswith("Bearer "):
49
return None
50
51
token = auth_header[7:] # Remove "Bearer " prefix
0 commit comments