mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Use runtime authentication for OpenAI MCP and app requests (#59749)
## What changed - Select fresh authentication for each HTTP operation on eligible OpenAI MCP connections while preserving the connection's credential source and account network policy. Stop redirects when requests carry runtime assertions. - Pass the owning thread's authentication and runtime context through app discovery, connector metadata, and trusted-access requests. Include the runtime authentication mode in MCP connection and tool-cache identities. - Give resumed actors analytics clients bound to their own authentication context, and serialize stored-credential reloads with token refresh while preserving host-provided credentials. ## Testing Add coverage for fresh request assertions, revoked account policies, redirect handling, resumed-actor isolation, and MCP uploads in dual-header and assertion-only modes. GitOrigin-RevId: f06900a6db61cd6cf53c3aa8075afeec4d5706d9
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
use codex_api::AuthError;
|
||||
use codex_api::SharedAuthProvider;
|
||||
use futures::future::BoxFuture;
|
||||
use http::HeaderMap;
|
||||
|
||||
/// Select request-scoped auth for each HTTP operation on a long-lived MCP connection.
|
||||
pub trait AuthProviderResolver: Send + Sync {
|
||||
fn resolve<'a>(
|
||||
&'a self,
|
||||
headers: &'a HeaderMap,
|
||||
) -> BoxFuture<'a, Result<SharedAuthProvider, AuthError>>;
|
||||
}
|
||||
|
||||
impl AuthProviderResolver for SharedAuthProvider {
|
||||
fn resolve<'a>(
|
||||
&'a self,
|
||||
_headers: &'a HeaderMap,
|
||||
) -> BoxFuture<'a, Result<SharedAuthProvider, AuthError>> {
|
||||
Box::pin(async move { Ok(self.clone()) })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user