From 74f12d0b55ba97b23230567a6d766597aa957b0d Mon Sep 17 00:00:00 2001 From: DenebTM Date: Thu, 31 Oct 2024 17:15:38 +0100 Subject: [PATCH] move LdapBackend to new submodule --- src/auth/{backends.rs => backends/ldap_backend.rs} | 14 ++------------ src/auth/backends/mod.rs | 13 +++++++++++++ src/auth/mod.rs | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) rename src/auth/{backends.rs => backends/ldap_backend.rs} (93%) create mode 100644 src/auth/backends/mod.rs 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;