actually validate that the LDAP bind succeeded
This commit is contained in:
parent
63487af2a4
commit
691bebf6ba
1 changed files with 14 additions and 2 deletions
|
@ -170,10 +170,22 @@ impl ValidateLogin for LdapBackend {
|
||||||
{
|
{
|
||||||
let (conn, mut ldap) = start_ldap_connection(&self.config).await?;
|
let (conn, mut ldap) = start_ldap_connection(&self.config).await?;
|
||||||
drive!(conn);
|
drive!(conn);
|
||||||
ldap.simple_bind(&search_entry.dn, password.0.expose_secret())
|
if let Err(ldap_error) = ldap
|
||||||
.await?;
|
.simple_bind(&search_entry.dn, password.0.expose_secret())
|
||||||
|
.await?
|
||||||
|
.success()
|
||||||
|
{
|
||||||
|
event!(
|
||||||
|
Level::TRACE,
|
||||||
|
dn = search_entry.dn,
|
||||||
|
ldap_error = ldap_error.to_string(),
|
||||||
|
"LDAP bind failed"
|
||||||
|
);
|
||||||
|
return Err(AuthenticationError::InvalidUserOrPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event!(Level::INFO, dn = search_entry.dn, "LDAP bind succeeded");
|
||||||
Ok(uid)
|
Ok(uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue