Add enterprise ID-JAG exchange for MCP OAuth (#40722)

## What changed

- Add a non-interactive two-step exchange that obtains an ID-JAG from an
  enterprise identity provider and trades it for a resource-bound MCP bearer
  token.
- Validate trusted endpoint URLs, request inputs, ID-JAG claims, resource and
  scope bindings, and token responses before credentials are forwarded or a
  bearer token is returned.
- Expose structured authentication failures while redacting credentials and
  provider-controlled error details from diagnostics.

## Testing

- Cover successful exchanges, signed scope narrowing, invalid claims and token
  responses, request validation, and error redaction.

GitOrigin-RevId: d716e0e1c2dc6b230cecbc0e9cc09afeee81d599
This commit is contained in:
Nick Steele authored and copyberry committed 2026-08-25 22:12:41 +00:00
1 parent d6174a8798
commit f6805328c4
6 files changed
+913 -1

No files matched your search

+8
View File
@@ -1,5 +1,8 @@
mod auth_status;
mod elicitation_client_service;
mod ema_auth_policy;
mod ema_claims;
mod ema_exchange;
mod event_notification_transport;
mod executor_process_transport;
mod http_client_adapter;
@@ -28,6 +31,11 @@ pub use auth_status::determine_streamable_http_auth_status;
pub use auth_status::determine_streamable_http_auth_status_from_credentials;
pub use auth_status::discover_streamable_http_oauth;
pub use codex_protocol::protocol::McpAuthStatus;
pub use ema_auth_policy::EmaAuthFailure;
pub use ema_auth_policy::EmaInvalidGrantSource;
pub use ema_exchange::EmaAccessToken;
pub use ema_exchange::EmaIdJagExchangeRequest;
pub use ema_exchange::exchange_id_jag;
pub use event_notification_transport::EventNotificationReceiver;
pub use http_client_adapter::StreamableHttpRedirectMode;
pub use http_headers::with_http_headers_helper;