mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-04 07:27:51 +00:00
* refactor(rust): move SecretValue into litellm-secret-value * docs(rust): add rust-redaction skill * refactor(redis-client): carry credentials as SecretValue --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
34 lines
956 B
Rust
34 lines
956 B
Rust
use litellm_auth::{
|
|
CredentialPlacement, CredentialPlanKind, CredentialRule, ExistingHeaderBehavior,
|
|
ProviderAuthPolicy, ResolvedCredential,
|
|
};
|
|
use litellm_secret_value::SecretValue;
|
|
|
|
const RULES: &[CredentialRule] = &[CredentialRule {
|
|
kind: CredentialPlanKind::Static,
|
|
placement: CredentialPlacement::Header("x-api-key"),
|
|
}];
|
|
|
|
#[test]
|
|
fn facade_applies_shared_auth_policy() {
|
|
let policy = ProviderAuthPolicy {
|
|
rules: RULES,
|
|
accepted_existing_headers: &["x-api-key"],
|
|
existing_header_behavior: ExistingHeaderBehavior::Preserve,
|
|
scope: None,
|
|
audience: None,
|
|
};
|
|
|
|
let headers = policy
|
|
.apply(
|
|
Vec::new(),
|
|
CredentialPlanKind::Static,
|
|
&ResolvedCredential::Static(SecretValue::new("secret")),
|
|
)
|
|
.expect("facade policy applies");
|
|
|
|
assert_eq!(
|
|
headers,
|
|
vec![("x-api-key".to_string(), "secret".to_string())]
|
|
);
|
|
}
|