WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-10 06:00:44 +01:00
parent 82347a58ed
commit 231e8cd136
661 changed files with 4924 additions and 64817 deletions

View File

@@ -1,5 +1,4 @@
use codex_api::AuthProvider;
use codex_http_client::CHATGPT_ACCOUNT_ID_HEADER;
use codex_login::auth::is_fedramp_api_key;
use http::HeaderMap;
use http::HeaderValue;
@@ -8,7 +7,6 @@ use http::HeaderValue;
#[derive(Clone, Default)]
pub struct BearerAuthProvider {
pub token: Option<String>,
pub account_id: Option<String>,
pub is_fedramp_account: bool,
}
@@ -17,15 +15,13 @@ impl BearerAuthProvider {
let is_fedramp_account = is_fedramp_api_key(&token);
Self {
token: Some(token),
account_id: None,
is_fedramp_account,
}
}
pub fn for_test(token: Option<&str>, account_id: Option<&str>) -> Self {
pub fn for_test(token: Option<&str>) -> Self {
Self {
token: token.map(str::to_string),
account_id: account_id.map(str::to_string),
is_fedramp_account: false,
}
}
@@ -38,11 +34,6 @@ impl AuthProvider for BearerAuthProvider {
{
let _ = headers.insert(http::header::AUTHORIZATION, header);
}
if let Some(account_id) = self.account_id.as_ref()
&& let Ok(header) = HeaderValue::from_str(account_id)
{
let _ = headers.insert(CHATGPT_ACCOUNT_ID_HEADER, header);
}
if self.is_fedramp_account {
let _ = headers.insert("X-OpenAI-Fedramp", HeaderValue::from_static("true"));
}