chore: initial sanitized public snapshot

This commit is contained in:
Aria2 Rust Pro Contributors
2026-07-18 14:04:26 +08:00
commit 7b3816441c
320 changed files with 76813 additions and 0 deletions
@@ -0,0 +1,59 @@
//! Authentication models shared across protocol connectors.
#![forbid(unsafe_code)]
use std::collections::HashMap;
/// Authentication scheme recognized by the protocol layer.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum AuthScheme {
/// HTTP Basic authentication.
Basic,
/// HTTP Digest authentication.
Digest,
/// Bearer-token authentication.
Bearer,
/// SPNEGO or Negotiate authentication.
Negotiate,
/// NTLM authentication.
Ntlm,
/// OAuth2-derived bearer flows.
OAuth2,
/// Caller accepts any supported scheme.
Any,
}
/// Authentication material supplied to a protocol connector.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AuthCredentialModel {
/// Scheme the credential applies to.
pub scheme: AuthScheme,
/// Optional username component.
pub username: Option<String>,
/// Optional password or shared secret.
pub password: Option<String>,
/// Optional opaque bearer token.
pub token: Option<String>,
/// Optional authentication realm.
pub realm: Option<String>,
}
/// Authentication challenge emitted by a server.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AuthChallengeModel {
/// Challenged scheme.
pub scheme: AuthScheme,
/// Optional realm attached to the challenge.
pub realm: Option<String>,
/// Additional challenge parameters keyed by attribute name.
pub parameters: HashMap<String, String>,
}
/// Cached credential entry associated with an origin.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AuthCacheEntry {
/// Origin or protection-space key.
pub origin: String,
/// Credential cached for the origin.
pub credential: AuthCredentialModel,
}