move LdapBackend to new submodule

This commit is contained in:
deneb 2024-10-31 17:15:38 +01:00
parent e894e8eb18
commit 74f12d0b55
3 changed files with 16 additions and 13 deletions

View file

@ -5,19 +5,9 @@ use secrecy::ExposeSecret;
use tokio::{sync::Mutex, time::sleep}; use tokio::{sync::Mutex, time::sleep};
use tracing::{event, instrument, Level}; use tracing::{event, instrument, Level};
use crate::{config::LdapBackendConfig, secrets::Password}; use crate::{auth::AuthenticationError, config::LdapBackendConfig, secrets::Password};
use super::AuthenticationError; use super::ValidateLogin;
pub trait ValidateLogin {
/// Validates that the given username and password combination is correct, and returns the
/// (normalized) user ID.
async fn validate_login(
&self,
username: &str,
password: &Password,
) -> Result<String, AuthenticationError>;
}
#[instrument] #[instrument]
async fn start_ldap_connection( async fn start_ldap_connection(

13
src/auth/backends/mod.rs Normal file
View file

@ -0,0 +1,13 @@
use crate::{auth::AuthenticationError, secrets::Password};
pub mod ldap_backend;
pub trait ValidateLogin {
/// Validates that the given username and password combination is correct, and returns the
/// (normalized) user ID.
async fn validate_login(
&self,
username: &str,
password: &Password,
) -> Result<String, AuthenticationError>;
}

View file

@ -24,7 +24,7 @@ use crate::{
}, },
}; };
use self::backends::{LdapBackend, ValidateLogin}; use self::backends::{ldap_backend::LdapBackend, ValidateLogin};
pub mod backends; pub mod backends;