feat: Implement LDAP bind/whoami
This commit is contained in:
parent
bdb5008914
commit
b4330b37fa
19 changed files with 664 additions and 37 deletions
|
|
@ -26,11 +26,13 @@ impl<D: DatabaseInterface> Database<D> {
|
|||
/// TODO: we may want to make sure the method runs in constant time
|
||||
/// to avoid leaking information about existing users...
|
||||
/// or maybe we do not care.
|
||||
async fn check_password(&self, user: &UserRef, password: &str) -> bool {
|
||||
pub async fn check_password(&self, user: &UserRef, password: &str) -> bool {
|
||||
let Some(user) = self.get_user(user).await else {
|
||||
tracing::debug!("check_password: User not found {user}");
|
||||
return false;
|
||||
};
|
||||
|
||||
tracing::debug!("Comparing {} and {}", user.password, password);
|
||||
user.password == password
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::db::error::*;
|
||||
use crate::db::error::UserAlreadyExists;
|
||||
use crate::db::{Database, User, UserRef};
|
||||
|
||||
impl<D: DatabaseInterface> DatabaseInterface for Database<D> {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::future::{Future, ready};
|
||||
|
||||
use crate::db::error::*;
|
||||
use crate::db::error::UserAlreadyExists;
|
||||
use crate::db::{Database, DatabaseInterface, Group, User, UserRef};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue