1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::agent::NonceFactory;
use crate::identity::anonymous::AnonymousIdentity;
use crate::identity::Identity;
pub trait PasswordManager {
fn cached(&self, url: &str) -> Result<Option<(String, String)>, String>;
fn required(&self, url: &str) -> Result<(String, String), String>;
}
pub struct AgentConfig {
pub url: String,
pub nonce_factory: NonceFactory,
pub identity: Box<dyn Identity + Send + Sync>,
pub password_manager: Option<Box<dyn PasswordManager + Send + Sync>>,
pub ingress_expiry_duration: Option<std::time::Duration>,
}
impl Default for AgentConfig {
fn default() -> Self {
Self {
url: "-".to_owned(),
nonce_factory: NonceFactory::random(),
identity: Box::new(AnonymousIdentity {}),
password_manager: None,
ingress_expiry_duration: None,
}
}
}