use super::IAuthenticator;
use scsys::Dictionary;
#[derive(Clone, Copy, Debug, Hash, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum AuthState {
Authorized,
Owner,
UnAuthorized,
}
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Authenticator {
pub authorizations: Dictionary,
pub endpoint: String,
}
impl Authenticator {
pub fn new(authorizations: Dictionary, endpoint: String) -> Self {
Self {
authorizations,
endpoint,
}
}
}
impl IAuthenticator<String, Vec<String>> for Authenticator {}
impl Default for Authenticator {
fn default() -> Self {
Self::new(Dictionary::new(), String::new())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_default_authenticator() {
let actual = Authenticator::default();
let expected = actual.clone();
assert_eq!(actual, expected)
}
}