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
use parsec_interface::requests::{request::RequestAuth, AuthType};
#[derive(Clone, Debug)]
pub enum AuthenticationData {
None,
AppIdentity(String),
}
impl AuthenticationData {
pub fn auth_type(&self) -> AuthType {
match self {
AuthenticationData::None => AuthType::NoAuth,
AuthenticationData::AppIdentity(_) => AuthType::Direct,
}
}
}
impl From<&AuthenticationData> for RequestAuth {
fn from(data: &AuthenticationData) -> Self {
match data {
AuthenticationData::None => Default::default(),
AuthenticationData::AppIdentity(name) => {
RequestAuth::from_bytes(name.bytes().collect())
}
}
}
}