refactor(rust): extract shared auth foundation from core

This commit is contained in:
Yujong Lee 2026-09-08 15:00:09 -07:00
parent 81bb960d8c
commit ebc91ad0cb
7 changed files with 31 additions and 2 deletions

View file

@ -1420,6 +1420,13 @@ dependencies = [
"tracing",
]
[[package]]
name = "litellm-auth"
version = "0.1.0"
dependencies = [
"tokio",
]
[[package]]
name = "litellm-auth-aws"
version = "0.1.0"

View file

@ -1,6 +1,7 @@
[workspace]
members = [
"crates/core",
"crates/auth",
"crates/config",
"crates/ai-gateway",
"crates/python-interop",

View file

@ -0,0 +1,9 @@
[package]
name = "litellm-auth"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true
[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt"] }

View file

@ -101,14 +101,21 @@ errors are language-neutral.
```
core must not depend on PyO3, Axum or gateway integration types
litellm-auth owns shared credential values, capability contracts and future static helpers
cloud-auth crates own reusable native credential and signing mechanisms
core owns provider precedence, header policy and authorization timing
Tower/Axum types stop at the gateway adapter boundary
provider transformation, auth and I/O remain in core
provider transformation, auth policy and I/O remain in core
request-scoped host state belongs to a call session
service construction dependencies do not leak into service interfaces
```
`litellm-auth` has only standard-library production dependencies and does not
depend on core or cloud crates. Add it as a dependency only where consumed.
Cloud crates retain their own credential types and errors. `AuthorizationFuture`
lives in `core::providers` because its result uses the core error type. The former
`core::auth` module is removed without compatibility re-exports
## Not the target
Do not introduce a dynamic `TypeId` service map, a shared gateway callback

View file

@ -1,5 +1,4 @@
pub mod audio_transcription;
pub mod auth;
pub mod chat_completions;
pub mod constants;
pub mod error;

View file

@ -1,3 +1,6 @@
use std::future::Future;
use std::pin::Pin;
pub mod anthropic;
pub mod azure_ai;
#[cfg(feature = "bedrock-auth")]
@ -6,3 +9,6 @@ pub mod mistral;
pub mod openai;
pub mod reducto;
pub mod vertex_ai;
pub type AuthorizationFuture<'a> =
Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, crate::Error>> + Send + 'a>>;