move LdapBackend to new submodule
This commit is contained in:
parent
e894e8eb18
commit
74f12d0b55
3 changed files with 16 additions and 13 deletions
|
@ -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
13
src/auth/backends/mod.rs
Normal 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>;
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::backends::{LdapBackend, ValidateLogin};
|
use self::backends::{ldap_backend::LdapBackend, ValidateLogin};
|
||||||
|
|
||||||
pub mod backends;
|
pub mod backends;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue