Files
codex/codex-rs/login/src/auth/auth_headers.rs
T
lt-oaiandpakrym-oai 8784de445e [codex] Add externally provided Codex auth (#31274)
## Summary

Add an in-memory externally provided Codex auth snapshot with explicit
runtime capabilities, installed through the existing `ExternalAuth`
provider path.

## Testing

- `just fmt-check`
- `cargo test -p codex-login --lib externally_provided_auth`
- `cargo test -p codex-core --lib
external_auth_snapshot_is_installed_from_runtime_config`
- `cargo test -p codex-model-provider --lib external_auth`
- `cargo test -p codex-mcp-extension --test hosted_apps_mcp
hosted_apps_mcp_accepts_external_provided_codex_auth`
- `cargo check -p codex-app-server -p codex-core-api -p
codex-thread-manager-sample`

---------

Co-authored-by: pakrym-oai <pakrym@openai.com>
2026-07-07 17:43:19 -07:00

31 lines
732 B
Rust

use std::fmt;
use reqwest::header::HeaderMap;
/// Request headers returned by an external auth provider.
///
/// The provider owns credential validation, rotation, and persistence. Codex
/// keeps the resolved headers in memory and attaches them to backend requests.
#[derive(Clone, PartialEq, Eq)]
pub struct AuthHeaders {
headers: HeaderMap,
}
impl AuthHeaders {
pub fn new(headers: HeaderMap) -> Self {
Self { headers }
}
pub fn headers(&self) -> &HeaderMap {
&self.headers
}
}
impl fmt::Debug for AuthHeaders {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AuthHeaders")
.field("headers", &"<redacted>")
.finish()
}
}