Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Fix #5115: OAuthProxy accepts self-contained ID-JAG tokens even when iden (#5119)

Nandana Dileepa01f83520286
diff --git a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py
index 320392caf..2d8f33871 100644
--- a/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py
+++ b/fastmcp_slim/fastmcp/server/auth/oauth_proxy/proxy.py
@@ -2174,6 +2174,12 @@ class OAuthProxy(OAuthProvider, ConsentMixin):
# swap for. Return directly from the verified claims, unless the
# token was revoked (tracked by jti until natural expiry).
if payload.get("fastmcp_grant") == _ID_JAG_GRANT_MARKER:
+ if self._identity_assertion is None:
+ logger.warning(
+ "Rejected ID-JAG token: identity assertion is not configured (jti=%s)",
+ jti[:16],
+ )
+ return None
if jti in self._revoked_id_jag_jtis:
logger.info("Rejected revoked ID-JAG access token jti=%s", jti[:16])
return None