Add preview warnings to native-keyring usage (#15555)

The refactor here was all done by Claude Code.
This commit is contained in:
Zanie Blue 2025-08-29 14:18:15 -05:00
parent 460ea6e9eb
commit 4ad5ae5e6f
14 changed files with 91 additions and 11 deletions

View file

@ -33,6 +33,7 @@ use uv_configuration::{KeyringProviderType, TrustedHost};
use uv_fs::Simplified;
use uv_pep508::MarkerEnvironment;
use uv_platform_tags::Platform;
use uv_preview::Preview;
use uv_redacted::DisplaySafeUrl;
use uv_static::EnvVars;
use uv_version::version;
@ -68,6 +69,7 @@ pub enum AuthIntegration {
#[derive(Debug, Clone)]
pub struct BaseClientBuilder<'a> {
keyring: KeyringProviderType,
preview: Preview,
allow_insecure_host: Vec<TrustedHost>,
native_tls: bool,
built_in_root_certs: bool,
@ -125,6 +127,7 @@ impl Default for BaseClientBuilder<'_> {
fn default() -> Self {
Self {
keyring: KeyringProviderType::default(),
preview: Preview::default(),
allow_insecure_host: vec![],
native_tls: false,
built_in_root_certs: false,
@ -486,13 +489,13 @@ impl<'a> BaseClientBuilder<'a> {
AuthIntegration::Default => {
let auth_middleware = AuthMiddleware::new()
.with_indexes(self.indexes.clone())
.with_keyring(self.keyring.to_provider());
.with_keyring(self.keyring.to_provider(&self.preview));
client = client.with(auth_middleware);
}
AuthIntegration::OnlyAuthenticated => {
let auth_middleware = AuthMiddleware::new()
.with_indexes(self.indexes.clone())
.with_keyring(self.keyring.to_provider())
.with_keyring(self.keyring.to_provider(&self.preview))
.with_only_authenticated(true);
client = client.with(auth_middleware);