feat: Implement LDAP bind/whoami

This commit is contained in:
selfhoster selfhoster 2026-09-01 21:18:19 +02:00
commit b4330b37fa
19 changed files with 664 additions and 37 deletions

View file

@ -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
}
}

View file

@ -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> {

View file

@ -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)]