distant_auth/methods/
none.rs

1use std::io;
2
3use async_trait::async_trait;
4
5use crate::authenticator::Authenticator;
6use crate::methods::AuthenticationMethod;
7
8/// Authenticaton method that skips authentication and approves anything.
9#[derive(Clone, Debug)]
10pub struct NoneAuthenticationMethod;
11
12impl NoneAuthenticationMethod {
13    pub const ID: &str = "none";
14
15    #[inline]
16    pub fn new() -> Self {
17        Self
18    }
19}
20
21impl Default for NoneAuthenticationMethod {
22    #[inline]
23    fn default() -> Self {
24        Self
25    }
26}
27
28#[async_trait]
29impl AuthenticationMethod for NoneAuthenticationMethod {
30    fn id(&self) -> &'static str {
31        Self::ID
32    }
33
34    async fn authenticate(&self, _: &mut dyn Authenticator) -> io::Result<()> {
35        Ok(())
36    }
37}