Add AWS Bedrock auth mode with per-project configuration
All checks were successful
Build Container / build-container (push) Successful in 3m29s

Introduces a third auth mode alongside Login and API Key, allowing
projects to authenticate Claude Code via AWS Bedrock. Includes support
for static credentials, profile-based, and bearer-token auth methods
with full UI controls. Also adds a URL accumulator to the terminal to
reassemble long OAuth URLs split across hard newlines, and installs
the AWS CLI v2 in the container image.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 14:29:40 +00:00
parent 625260b060
commit ca51e73924
8 changed files with 332 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ pub struct Project {
pub container_id: Option<String>,
pub status: ProjectStatus,
pub auth_mode: AuthMode,
pub bedrock_config: Option<BedrockConfig>,
pub allow_docker_access: bool,
pub ssh_key_path: Option<String>,
pub git_token: Option<String>,
@@ -30,11 +31,13 @@ pub enum ProjectStatus {
/// How the project authenticates with Claude.
/// - `Login`: User runs `claude login` inside the container (OAuth, persisted via config volume)
/// - `ApiKey`: Uses the API key stored in the OS keychain
/// - `Bedrock`: Uses AWS Bedrock with per-project AWS credentials
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum AuthMode {
Login,
ApiKey,
Bedrock,
}
impl Default for AuthMode {
@@ -43,6 +46,35 @@ impl Default for AuthMode {
}
}
/// How Bedrock authenticates with AWS.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BedrockAuthMethod {
StaticCredentials,
Profile,
BearerToken,
}
impl Default for BedrockAuthMethod {
fn default() -> Self {
Self::StaticCredentials
}
}
/// AWS Bedrock configuration for a project.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BedrockConfig {
pub auth_method: BedrockAuthMethod,
pub aws_region: String,
pub aws_access_key_id: Option<String>,
pub aws_secret_access_key: Option<String>,
pub aws_session_token: Option<String>,
pub aws_profile: Option<String>,
pub aws_bearer_token: Option<String>,
pub model_id: Option<String>,
pub disable_prompt_caching: bool,
}
impl Project {
pub fn new(name: String, path: String) -> Self {
let now = chrono::Utc::now().to_rfc3339();
@@ -53,6 +85,7 @@ impl Project {
container_id: None,
status: ProjectStatus::Stopped,
auth_mode: AuthMode::default(),
bedrock_config: None,
allow_docker_access: false,
ssh_key_path: None,
git_token: None,