Support managed AWS access keys for Amazon Bedrock (#40481)

## What changed

- Add the experimental `amazonBedrockAccessKeys` app-server login flow, persist its credentials in the configured auth store, and use them for SigV4-signed Bedrock requests.
- Report `bedrockAccessKeys` as a distinct auth mode and document access-key login alongside AWS profile and environment credential setup.
- Clear the selected Bedrock provider, AWS settings, and Bedrock-specific model on logout while leaving external AWS credentials and `.env` untouched.
- Reject managed access-key login when higher-precedence configuration would prevent its region or profile settings from taking effect.

## Testing

- Cover access-key login, storage, request signing, configuration conflicts, status reporting, and logout cleanup.

GitOrigin-RevId: bbf297887c6503d3651ceb2aad85c4d626e32723
This commit is contained in:
alexsong-oai authored and copyberry committed 2026-08-24 21:39:48 +00:00
1 parent 219c203417
commit 4f6d43c267
60 files changed
+1464 -389

No files matched your search

+7 -2
View File
@@ -206,7 +206,10 @@ pub(crate) fn resolve_provider_auth(
return Ok(unauthenticated_auth_provider());
}
if matches!(auth, Some(CodexAuth::BedrockApiKey(_))) {
if matches!(
auth,
Some(CodexAuth::BedrockApiKey(_) | CodexAuth::BedrockAccessKeys(_))
) {
return Err(CodexErr::UnsupportedOperation(
BEDROCK_API_KEY_UNSUPPORTED_MESSAGE.to_string(),
));
@@ -307,7 +310,9 @@ pub fn auth_provider_from_auth(auth: &CodexAuth) -> SharedAuthProvider {
Arc::new(AgentIdentityAuthProvider { auth: auth.clone() })
}
CodexAuth::Headers(auth) => Arc::new(HeaderAuthProvider { auth: auth.clone() }),
CodexAuth::BedrockApiKey(_) => unreachable!("{BEDROCK_API_KEY_UNSUPPORTED_MESSAGE}"),
CodexAuth::BedrockApiKey(_) | CodexAuth::BedrockAccessKeys(_) => {
unreachable!("{BEDROCK_API_KEY_UNSUPPORTED_MESSAGE}")
}
CodexAuth::ApiKey(_)
| CodexAuth::Chatgpt(_)
| CodexAuth::ChatgptAuthTokens(_)