zino_auth/
basic_credentials.rs

1use serde::{Deserialize, Serialize};
2
3/// Credentials for the HTTP basic authentication.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct BasicCredentials {
6    /// Username.
7    #[serde(alias = "account")]
8    username: String,
9    /// Password.
10    password: String,
11}
12
13impl BasicCredentials {
14    /// Creates a new instance.
15    #[inline]
16    pub fn new(username: String, password: String) -> Self {
17        Self { username, password }
18    }
19
20    /// Returns the username.
21    #[inline]
22    pub fn username(&self) -> &str {
23        &self.username
24    }
25
26    /// Returns the password.
27    #[inline]
28    pub fn password(&self) -> &str {
29        &self.password
30    }
31}