server: refactor auth_service to use Results

This simplifies the flow, and gets rid of wrong clippy warnings about
missing awaits due to the instrumentation.
This commit is contained in:
Valentin Tolmer
2022-06-30 15:51:56 +02:00
committed by nitnelave
parent 23a4763914
commit 1a03346a38
5 changed files with 278 additions and 259 deletions

View File

@@ -90,17 +90,6 @@ impl SqlBackendHandler {
impl LoginHandler for SqlBackendHandler {
#[instrument(skip_all, level = "debug", err)]
async fn bind(&self, request: BindRequest) -> Result<()> {
if request.name == self.config.ldap_user_dn {
if SecUtf8::from(request.password) == self.config.ldap_user_pass {
return Ok(());
} else {
debug!(r#"Invalid password for LDAP bind user"#);
return Err(DomainError::AuthenticationError(format!(
" for user '{}'",
request.name
)));
}
}
let (query, values) = Query::select()
.column(Users::PasswordHash)
.from(Users::Table)