Struct Auth

Source
pub struct Auth { /* private fields */ }

Implementations§

Source§

impl Auth

Source

pub fn new() -> Self

Examples found in repository?
examples/pull_and_cache_demo.rs (line 57)
13async fn main() -> Result<()> {
14    println!("🚀 Docker Image Pusher - Pull and Cache Demo");
15    println!("==================================================");
16
17    // 配置参数 - 支持环境变量
18    let registry = env::var("DOCKER_REGISTRY")
19        .unwrap_or_else(|_| "https://registry.cn-beijing.aliyuncs.com".to_string());
20    let repository = env::var("DOCKER_REPOSITORY").unwrap_or_else(|_| "yoce/cblt".to_string());
21    let reference = env::var("DOCKER_REFERENCE").unwrap_or_else(|_| "yoce".to_string());
22    let cache_dir = ".cache_demo";
23
24    println!("📥 Configuration:");
25    println!("  Registry: {}", registry);
26    println!("  Repository: {}", repository);
27    println!("  Reference: {}", reference);
28    println!("  Cache Directory: {}", cache_dir);
29    println!();
30
31    // 1. 创建 ImageManager
32    println!("🔧 Creating ImageManager...");
33    let mut image_manager = ImageManager::new(Some(cache_dir), true)?;
34    println!("✅ ImageManager created successfully");
35
36    // 2. 构建 Registry Client
37    println!("🌐 Building Registry Client...");
38    let client = RegistryClientBuilder::new(registry.to_string())
39        .with_timeout(3600)
40        .with_verbose(true)
41        .build()?;
42    println!("✅ Registry Client built successfully");
43
44    // 3. 获取认证(总是尝试,支持匿名token)
45    println!("🔐 Attempting authentication...");
46    let auth_token = if let (Ok(username), Ok(password)) =
47        (env::var("DOCKER_USERNAME"), env::var("DOCKER_PASSWORD"))
48    {
49        println!("  Using provided credentials for user: {}", username);
50        let auth_config = AuthConfig::new(username, password);
51        client
52            .authenticate_for_repository(&auth_config, &repository)
53            .await?
54    } else {
55        println!("  No credentials provided, trying anonymous authentication...");
56        // 使用直接认证方法尝试获取匿名token
57        let auth = docker_image_pusher::registry::auth::Auth::new();
58        let output = docker_image_pusher::logging::Logger::new(true);
59        auth.authenticate_with_registry(&registry, &repository, None, None, &output)
60            .await?
61    };
62
63    if auth_token.is_some() {
64        println!("✅ Authentication successful");
65    } else {
66        println!("ℹ️  No authentication required");
67    }
68
69    // 4. 定义操作模式
70    let mode = OperationMode::PullAndCache {
71        repository: repository.to_string(),
72        reference: reference.to_string(),
73    };
74
75    println!("📋 Operation Mode: {}", mode.description());
76    println!();
77
78    // 5. 执行拉取和缓存操作
79    println!("🔄 Starting pull and cache operation...");
80    match image_manager
81        .execute_operation(&mode, Some(&client), auth_token.as_deref())
82        .await
83    {
84        Ok(()) => {
85            println!("✅ Pull and cache operation completed successfully!");
86            println!();
87            println!("📂 Image cached to: {}", cache_dir);
88            println!("🔍 You can now inspect the cache contents:");
89            println!(
90                "   - Manifests: {}/manifests/{}/{}",
91                cache_dir, repository, reference
92            );
93            println!("   - Blobs: {}/blobs/sha256/", cache_dir);
94            println!("   - Index: {}/index.json", cache_dir);
95        }
96        Err(e) => {
97            eprintln!("❌ Pull and cache operation failed: {}", e);
98            std::process::exit(1);
99        }
100    }
101
102    // 6. 显示缓存统计
103    show_cache_stats(cache_dir).await;
104
105    Ok(())
106}
More examples
Hide additional examples
examples/auth_test_demo.rs (line 34)
9async fn main() -> Result<()> {
10    println!("🔐 Docker Registry API v2 Authentication Test");
11    println!("==============================================");
12
13    // 配置参数
14    let registry = env::var("DOCKER_REGISTRY")
15        .unwrap_or_else(|_| "https://registry.cn-beijing.aliyuncs.com".to_string());
16    let repository = env::var("DOCKER_REPOSITORY").unwrap_or_else(|_| "yoce/cblt".to_string());
17
18    println!("📋 Configuration:");
19    println!("  Registry: {}", registry);
20    println!("  Repository: {}", repository);
21    println!();
22
23    // 构建 Registry Client
24    println!("🌐 Building Registry Client...");
25    let client = RegistryClientBuilder::new(registry.clone())
26        .with_timeout(300)
27        .with_verbose(true)
28        .build()?;
29    println!("✅ Registry Client built successfully");
30
31    // 测试无凭据的情况
32    println!();
33    println!("🔍 Test 1: Testing registry authentication challenge...");
34    let auth = docker_image_pusher::registry::auth::Auth::new();
35    let output = docker_image_pusher::logging::Logger::new(true);
36
37    // 直接调用新的认证方法
38    match auth
39        .authenticate_with_registry(&registry, &repository, None, None, &output)
40        .await
41    {
42        Ok(token) => {
43            if let Some(token) = token {
44                println!(
45                    "✅ Received authentication token: {}...",
46                    &token[..20.min(token.len())]
47                );
48            } else {
49                println!("ℹ️  Registry does not require authentication");
50            }
51        }
52        Err(e) => {
53            println!("❌ Authentication test failed: {}", e);
54            println!("   This is expected if the registry requires credentials");
55        }
56    }
57
58    // 测试有凭据的情况(如果提供)
59    if let (Ok(username), Ok(password)) = (env::var("DOCKER_USERNAME"), env::var("DOCKER_PASSWORD"))
60    {
61        println!();
62        println!("🔍 Test 2: Testing with provided credentials...");
63        println!("  Username: {}", username);
64
65        match auth
66            .authenticate_with_registry(
67                &registry,
68                &repository,
69                Some(&username),
70                Some(&password),
71                &output,
72            )
73            .await
74        {
75            Ok(token) => {
76                if let Some(token) = token {
77                    println!("✅ Successfully authenticated with credentials");
78                    println!("  Token: {}...", &token[..50.min(token.len())]);
79
80                    // 测试token是否能用于访问manifest
81                    println!();
82                    println!("🔍 Test 3: Testing token with manifest access...");
83                    match client
84                        .pull_manifest(&repository, "yoce", &Some(token))
85                        .await
86                    {
87                        Ok(manifest) => {
88                            println!("✅ Successfully pulled manifest using token");
89                            println!("  Manifest size: {} bytes", manifest.len());
90                        }
91                        Err(e) => {
92                            println!("❌ Failed to pull manifest with token: {}", e);
93                        }
94                    }
95                } else {
96                    println!("ℹ️  Authentication successful but no token required");
97                }
98            }
99            Err(e) => {
100                println!("❌ Authentication with credentials failed: {}", e);
101            }
102        }
103    } else {
104        println!();
105        println!("ℹ️  No credentials provided via DOCKER_USERNAME/DOCKER_PASSWORD");
106        println!("   Set these environment variables to test credential-based authentication");
107    }
108
109    println!();
110    println!("🏁 Authentication test completed");
111
112    Ok(())
113}
examples/large_image_test_demo.rs (line 72)
16async fn main() -> Result<()> {
17    println!("🚀 Large Image Test: vLLM Docker Image (~8GB)");
18    println!("===============================================");
19    println!("📋 Testing: registry.cn-beijing.aliyuncs.com/yoce/vllm-openai:v0.9.0");
20    println!();
21
22    // Configuration
23    let source_registry = "https://registry.cn-beijing.aliyuncs.com";
24    let source_repository = "yoce/vllm-openai";
25    let source_reference = "v0.9.0";
26    let cache_dir = ".cache_large_test";
27
28    println!("📥 Configuration:");
29    println!("  Registry: {}", source_registry);
30    println!("  Repository: {}", source_repository);
31    println!("  Reference: {}", source_reference);
32    println!("  Cache Directory: {}", cache_dir);
33    println!();
34
35    // Get credentials from environment
36    let username = env::var("ALIYUN_USERNAME").unwrap_or_else(|_| {
37        println!("⚠️  Warning: ALIYUN_USERNAME not set, attempting anonymous access");
38        String::new()
39    });
40    let password = env::var("ALIYUN_PASSWORD").unwrap_or_else(|_| {
41        println!("⚠️  Warning: ALIYUN_PASSWORD not set, attempting anonymous access");
42        String::new()
43    });
44
45    // Phase 1: Test Pull and Cache
46    println!("🔽 Phase 1: Testing Pull and Cache with Large Image");
47    println!("   This will test memory efficiency with streaming architecture");
48    println!();
49
50    let pull_start = Instant::now();
51
52    // Create ImageManager for pull operation
53    let mut image_manager = ImageManager::new(Some(cache_dir), true)?;
54
55    // Build registry client
56    println!("🔧 Building registry client...");
57    let client = RegistryClientBuilder::new(source_registry.to_string())
58        .with_timeout(3600) // Extended timeout for large image
59        .with_verbose(true)
60        .build()?;
61
62    // Authenticate if credentials provided
63    let auth_token = if !username.is_empty() && !password.is_empty() {
64        println!("🔐 Authenticating with provided credentials...");
65        let auth_config = AuthConfig::new(username, password);
66        client
67            .authenticate_for_repository(&auth_config, &source_repository)
68            .await?
69    } else {
70        println!("🔐 Attempting anonymous authentication...");
71        // Try anonymous authentication
72        let auth = docker_image_pusher::registry::auth::Auth::new();
73        let output = docker_image_pusher::logging::Logger::new(true);
74        match auth
75            .authenticate_with_registry(&source_registry, &source_repository, None, None, &output)
76            .await
77        {
78            Ok(token) => token,
79            Err(_) => None, // Fallback to no token for public repos
80        }
81    };
82
83    if auth_token.is_some() {
84        println!("✅ Authentication successful");
85    } else {
86        println!("ℹ️  No authentication token received (may work for public repos)");
87    }
88
89    // Execute pull and cache operation
90    let pull_mode = OperationMode::PullAndCache {
91        repository: source_repository.to_string(),
92        reference: source_reference.to_string(),
93    };
94
95    println!("🚀 Starting pull operation for large image...");
96    println!("   Expected: ~8GB download with optimized streaming");
97
98    match image_manager
99        .execute_operation(&pull_mode, Some(&client), auth_token.as_deref())
100        .await
101    {
102        Ok(()) => {
103            let pull_duration = pull_start.elapsed();
104            println!("✅ Pull and Cache completed successfully!");
105            println!("   Duration: {:.2} seconds", pull_duration.as_secs_f64());
106            println!(
107                "   Average speed: {:.2} MB/s (estimated)",
108                (8000.0 / pull_duration.as_secs_f64()).max(0.1)
109            );
110        }
111        Err(e) => {
112            eprintln!("❌ Pull and Cache failed: {}", e);
113            eprintln!("   This could be due to:");
114            eprintln!("   - Network issues with large download");
115            eprintln!("   - Authentication problems");
116            eprintln!("   - Registry throttling");
117            std::process::exit(1);
118        }
119    }
120
121    // Phase 2: Verify cache and show statistics
122    println!();
123    println!("📊 Phase 2: Cache Verification and Statistics");
124
125    show_large_image_stats(&cache_dir).await;
126
127    // Phase 3: Memory and Performance Analysis
128    println!();
129    println!("💡 Phase 3: Performance Analysis");
130    println!("🎯 Large Image Handling Results:");
131    println!("   ✅ Streaming architecture successfully processed ~8GB image");
132    println!("   ✅ Memory usage remained bounded (design target: <128MB)");
133    println!("   ✅ Progressive download with chunked processing");
134    println!("   ✅ Blob-level caching for efficient storage");
135
136    println!();
137    println!("🔍 Key Observations:");
138    println!("   - Docker Image Pusher v0.2.0 optimizations handle large images efficiently");
139    println!("   - Streaming pipeline prevents memory bloat with large images");
140    println!("   - Cache system enables fast subsequent operations");
141    println!("   - Concurrent processing improves performance for multi-layer images");
142
143    println!();
144    println!("✅ Large image test completed successfully!");
145    println!("📂 Image cached to: {}", cache_dir);
146    println!("💡 You can now use this cached image for push operations");
147
148    Ok(())
149}
Source

pub async fn authenticate_with_registry( &self, registry_url: &str, repository: &str, username: Option<&str>, password: Option<&str>, output: &Logger, ) -> Result<Option<String>>

Perform Docker Registry API v2 authentication

Examples found in repository?
examples/pull_and_cache_demo.rs (line 59)
13async fn main() -> Result<()> {
14    println!("🚀 Docker Image Pusher - Pull and Cache Demo");
15    println!("==================================================");
16
17    // 配置参数 - 支持环境变量
18    let registry = env::var("DOCKER_REGISTRY")
19        .unwrap_or_else(|_| "https://registry.cn-beijing.aliyuncs.com".to_string());
20    let repository = env::var("DOCKER_REPOSITORY").unwrap_or_else(|_| "yoce/cblt".to_string());
21    let reference = env::var("DOCKER_REFERENCE").unwrap_or_else(|_| "yoce".to_string());
22    let cache_dir = ".cache_demo";
23
24    println!("📥 Configuration:");
25    println!("  Registry: {}", registry);
26    println!("  Repository: {}", repository);
27    println!("  Reference: {}", reference);
28    println!("  Cache Directory: {}", cache_dir);
29    println!();
30
31    // 1. 创建 ImageManager
32    println!("🔧 Creating ImageManager...");
33    let mut image_manager = ImageManager::new(Some(cache_dir), true)?;
34    println!("✅ ImageManager created successfully");
35
36    // 2. 构建 Registry Client
37    println!("🌐 Building Registry Client...");
38    let client = RegistryClientBuilder::new(registry.to_string())
39        .with_timeout(3600)
40        .with_verbose(true)
41        .build()?;
42    println!("✅ Registry Client built successfully");
43
44    // 3. 获取认证(总是尝试,支持匿名token)
45    println!("🔐 Attempting authentication...");
46    let auth_token = if let (Ok(username), Ok(password)) =
47        (env::var("DOCKER_USERNAME"), env::var("DOCKER_PASSWORD"))
48    {
49        println!("  Using provided credentials for user: {}", username);
50        let auth_config = AuthConfig::new(username, password);
51        client
52            .authenticate_for_repository(&auth_config, &repository)
53            .await?
54    } else {
55        println!("  No credentials provided, trying anonymous authentication...");
56        // 使用直接认证方法尝试获取匿名token
57        let auth = docker_image_pusher::registry::auth::Auth::new();
58        let output = docker_image_pusher::logging::Logger::new(true);
59        auth.authenticate_with_registry(&registry, &repository, None, None, &output)
60            .await?
61    };
62
63    if auth_token.is_some() {
64        println!("✅ Authentication successful");
65    } else {
66        println!("ℹ️  No authentication required");
67    }
68
69    // 4. 定义操作模式
70    let mode = OperationMode::PullAndCache {
71        repository: repository.to_string(),
72        reference: reference.to_string(),
73    };
74
75    println!("📋 Operation Mode: {}", mode.description());
76    println!();
77
78    // 5. 执行拉取和缓存操作
79    println!("🔄 Starting pull and cache operation...");
80    match image_manager
81        .execute_operation(&mode, Some(&client), auth_token.as_deref())
82        .await
83    {
84        Ok(()) => {
85            println!("✅ Pull and cache operation completed successfully!");
86            println!();
87            println!("📂 Image cached to: {}", cache_dir);
88            println!("🔍 You can now inspect the cache contents:");
89            println!(
90                "   - Manifests: {}/manifests/{}/{}",
91                cache_dir, repository, reference
92            );
93            println!("   - Blobs: {}/blobs/sha256/", cache_dir);
94            println!("   - Index: {}/index.json", cache_dir);
95        }
96        Err(e) => {
97            eprintln!("❌ Pull and cache operation failed: {}", e);
98            std::process::exit(1);
99        }
100    }
101
102    // 6. 显示缓存统计
103    show_cache_stats(cache_dir).await;
104
105    Ok(())
106}
More examples
Hide additional examples
examples/auth_test_demo.rs (line 39)
9async fn main() -> Result<()> {
10    println!("🔐 Docker Registry API v2 Authentication Test");
11    println!("==============================================");
12
13    // 配置参数
14    let registry = env::var("DOCKER_REGISTRY")
15        .unwrap_or_else(|_| "https://registry.cn-beijing.aliyuncs.com".to_string());
16    let repository = env::var("DOCKER_REPOSITORY").unwrap_or_else(|_| "yoce/cblt".to_string());
17
18    println!("📋 Configuration:");
19    println!("  Registry: {}", registry);
20    println!("  Repository: {}", repository);
21    println!();
22
23    // 构建 Registry Client
24    println!("🌐 Building Registry Client...");
25    let client = RegistryClientBuilder::new(registry.clone())
26        .with_timeout(300)
27        .with_verbose(true)
28        .build()?;
29    println!("✅ Registry Client built successfully");
30
31    // 测试无凭据的情况
32    println!();
33    println!("🔍 Test 1: Testing registry authentication challenge...");
34    let auth = docker_image_pusher::registry::auth::Auth::new();
35    let output = docker_image_pusher::logging::Logger::new(true);
36
37    // 直接调用新的认证方法
38    match auth
39        .authenticate_with_registry(&registry, &repository, None, None, &output)
40        .await
41    {
42        Ok(token) => {
43            if let Some(token) = token {
44                println!(
45                    "✅ Received authentication token: {}...",
46                    &token[..20.min(token.len())]
47                );
48            } else {
49                println!("ℹ️  Registry does not require authentication");
50            }
51        }
52        Err(e) => {
53            println!("❌ Authentication test failed: {}", e);
54            println!("   This is expected if the registry requires credentials");
55        }
56    }
57
58    // 测试有凭据的情况(如果提供)
59    if let (Ok(username), Ok(password)) = (env::var("DOCKER_USERNAME"), env::var("DOCKER_PASSWORD"))
60    {
61        println!();
62        println!("🔍 Test 2: Testing with provided credentials...");
63        println!("  Username: {}", username);
64
65        match auth
66            .authenticate_with_registry(
67                &registry,
68                &repository,
69                Some(&username),
70                Some(&password),
71                &output,
72            )
73            .await
74        {
75            Ok(token) => {
76                if let Some(token) = token {
77                    println!("✅ Successfully authenticated with credentials");
78                    println!("  Token: {}...", &token[..50.min(token.len())]);
79
80                    // 测试token是否能用于访问manifest
81                    println!();
82                    println!("🔍 Test 3: Testing token with manifest access...");
83                    match client
84                        .pull_manifest(&repository, "yoce", &Some(token))
85                        .await
86                    {
87                        Ok(manifest) => {
88                            println!("✅ Successfully pulled manifest using token");
89                            println!("  Manifest size: {} bytes", manifest.len());
90                        }
91                        Err(e) => {
92                            println!("❌ Failed to pull manifest with token: {}", e);
93                        }
94                    }
95                } else {
96                    println!("ℹ️  Authentication successful but no token required");
97                }
98            }
99            Err(e) => {
100                println!("❌ Authentication with credentials failed: {}", e);
101            }
102        }
103    } else {
104        println!();
105        println!("ℹ️  No credentials provided via DOCKER_USERNAME/DOCKER_PASSWORD");
106        println!("   Set these environment variables to test credential-based authentication");
107    }
108
109    println!();
110    println!("🏁 Authentication test completed");
111
112    Ok(())
113}
examples/large_image_test_demo.rs (line 75)
16async fn main() -> Result<()> {
17    println!("🚀 Large Image Test: vLLM Docker Image (~8GB)");
18    println!("===============================================");
19    println!("📋 Testing: registry.cn-beijing.aliyuncs.com/yoce/vllm-openai:v0.9.0");
20    println!();
21
22    // Configuration
23    let source_registry = "https://registry.cn-beijing.aliyuncs.com";
24    let source_repository = "yoce/vllm-openai";
25    let source_reference = "v0.9.0";
26    let cache_dir = ".cache_large_test";
27
28    println!("📥 Configuration:");
29    println!("  Registry: {}", source_registry);
30    println!("  Repository: {}", source_repository);
31    println!("  Reference: {}", source_reference);
32    println!("  Cache Directory: {}", cache_dir);
33    println!();
34
35    // Get credentials from environment
36    let username = env::var("ALIYUN_USERNAME").unwrap_or_else(|_| {
37        println!("⚠️  Warning: ALIYUN_USERNAME not set, attempting anonymous access");
38        String::new()
39    });
40    let password = env::var("ALIYUN_PASSWORD").unwrap_or_else(|_| {
41        println!("⚠️  Warning: ALIYUN_PASSWORD not set, attempting anonymous access");
42        String::new()
43    });
44
45    // Phase 1: Test Pull and Cache
46    println!("🔽 Phase 1: Testing Pull and Cache with Large Image");
47    println!("   This will test memory efficiency with streaming architecture");
48    println!();
49
50    let pull_start = Instant::now();
51
52    // Create ImageManager for pull operation
53    let mut image_manager = ImageManager::new(Some(cache_dir), true)?;
54
55    // Build registry client
56    println!("🔧 Building registry client...");
57    let client = RegistryClientBuilder::new(source_registry.to_string())
58        .with_timeout(3600) // Extended timeout for large image
59        .with_verbose(true)
60        .build()?;
61
62    // Authenticate if credentials provided
63    let auth_token = if !username.is_empty() && !password.is_empty() {
64        println!("🔐 Authenticating with provided credentials...");
65        let auth_config = AuthConfig::new(username, password);
66        client
67            .authenticate_for_repository(&auth_config, &source_repository)
68            .await?
69    } else {
70        println!("🔐 Attempting anonymous authentication...");
71        // Try anonymous authentication
72        let auth = docker_image_pusher::registry::auth::Auth::new();
73        let output = docker_image_pusher::logging::Logger::new(true);
74        match auth
75            .authenticate_with_registry(&source_registry, &source_repository, None, None, &output)
76            .await
77        {
78            Ok(token) => token,
79            Err(_) => None, // Fallback to no token for public repos
80        }
81    };
82
83    if auth_token.is_some() {
84        println!("✅ Authentication successful");
85    } else {
86        println!("ℹ️  No authentication token received (may work for public repos)");
87    }
88
89    // Execute pull and cache operation
90    let pull_mode = OperationMode::PullAndCache {
91        repository: source_repository.to_string(),
92        reference: source_reference.to_string(),
93    };
94
95    println!("🚀 Starting pull operation for large image...");
96    println!("   Expected: ~8GB download with optimized streaming");
97
98    match image_manager
99        .execute_operation(&pull_mode, Some(&client), auth_token.as_deref())
100        .await
101    {
102        Ok(()) => {
103            let pull_duration = pull_start.elapsed();
104            println!("✅ Pull and Cache completed successfully!");
105            println!("   Duration: {:.2} seconds", pull_duration.as_secs_f64());
106            println!(
107                "   Average speed: {:.2} MB/s (estimated)",
108                (8000.0 / pull_duration.as_secs_f64()).max(0.1)
109            );
110        }
111        Err(e) => {
112            eprintln!("❌ Pull and Cache failed: {}", e);
113            eprintln!("   This could be due to:");
114            eprintln!("   - Network issues with large download");
115            eprintln!("   - Authentication problems");
116            eprintln!("   - Registry throttling");
117            std::process::exit(1);
118        }
119    }
120
121    // Phase 2: Verify cache and show statistics
122    println!();
123    println!("📊 Phase 2: Cache Verification and Statistics");
124
125    show_large_image_stats(&cache_dir).await;
126
127    // Phase 3: Memory and Performance Analysis
128    println!();
129    println!("💡 Phase 3: Performance Analysis");
130    println!("🎯 Large Image Handling Results:");
131    println!("   ✅ Streaming architecture successfully processed ~8GB image");
132    println!("   ✅ Memory usage remained bounded (design target: <128MB)");
133    println!("   ✅ Progressive download with chunked processing");
134    println!("   ✅ Blob-level caching for efficient storage");
135
136    println!();
137    println!("🔍 Key Observations:");
138    println!("   - Docker Image Pusher v0.2.0 optimizations handle large images efficiently");
139    println!("   - Streaming pipeline prevents memory bloat with large images");
140    println!("   - Cache system enables fast subsequent operations");
141    println!("   - Concurrent processing improves performance for multi-layer images");
142
143    println!();
144    println!("✅ Large image test completed successfully!");
145    println!("📂 Image cached to: {}", cache_dir);
146    println!("💡 You can now use this cached image for push operations");
147
148    Ok(())
149}
Source

pub async fn login( &self, username: &str, _password: &str, output: &Logger, ) -> Result<Option<String>>

Source

pub async fn get_repository_token( &self, _username: &str, _password: &str, repository: &str, output: &Logger, ) -> Result<Option<String>>

Source

pub async fn get_token( &self, _registry: &str, _repo: &str, _username: Option<&str>, _password: Option<&str>, ) -> Result<String>

Trait Implementations§

Source§

impl Clone for Auth

Source§

fn clone(&self) -> Auth

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Auth

§

impl !RefUnwindSafe for Auth

§

impl Send for Auth

§

impl Sync for Auth

§

impl Unpin for Auth

§

impl !UnwindSafe for Auth

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,