diff --git a/src/auth/backends.rs b/src/auth/backends/ldap_backend.rs similarity index 93% rename from src/auth/backends.rs rename to src/auth/backends/ldap_backend.rs index 2c8fabc..25dfc3c 100644 --- a/src/auth/backends.rs +++ b/src/auth/backends/ldap_backend.rs @@ -5,19 +5,9 @@ use secrecy::ExposeSecret; use tokio::{sync::Mutex, time::sleep}; use tracing::{event, instrument, Level}; -use crate::{config::LdapBackendConfig, secrets::Password}; +use crate::{auth::AuthenticationError, config::LdapBackendConfig, secrets::Password}; -use super::AuthenticationError; - -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; -} +use super::ValidateLogin; #[instrument] async fn start_ldap_connection( diff --git a/src/auth/backends/mod.rs b/src/auth/backends/mod.rs new file mode 100644 index 0000000..9e04815 --- /dev/null +++ b/src/auth/backends/mod.rs @@ -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; +} diff --git a/src/auth/mod.rs b/src/auth/mod.rs index 2b2d385..4f84ffa 100644 --- a/src/auth/mod.rs +++ b/src/auth/mod.rs @@ -24,7 +24,7 @@ use crate::{ }, }; -use self::backends::{LdapBackend, ValidateLogin}; +use self::backends::{ldap_backend::LdapBackend, ValidateLogin}; pub mod backends;