mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
Misc cleanup
This commit is contained in:
parent
86b89a00cc
commit
03e6afda69
@ -38,7 +38,9 @@ impl SqlBackendHandler {
|
||||
|
||||
impl BackendHandler for SqlBackendHandler {
|
||||
fn bind(&mut self, request: BindRequest) -> Result<()> {
|
||||
if request.name == self.config.admin_dn && request.password == self.config.admin_password {
|
||||
if request.name == self.config.ldap_user_dn
|
||||
&& request.password == self.config.ldap_user_pass
|
||||
{
|
||||
self.authenticated = true;
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -13,8 +13,9 @@ pub struct Configuration {
|
||||
pub ldaps_port: u16,
|
||||
pub http_port: u16,
|
||||
pub secret_pepper: String,
|
||||
pub admin_dn: String,
|
||||
pub admin_password: String,
|
||||
pub ldap_user_dn: String,
|
||||
pub ldap_user_pass: String,
|
||||
pub database_url: String,
|
||||
pub verbose: bool,
|
||||
}
|
||||
|
||||
@ -25,8 +26,9 @@ impl Default for Configuration {
|
||||
ldaps_port: 6360,
|
||||
http_port: 17170,
|
||||
secret_pepper: String::from("secretsecretpepper"),
|
||||
admin_dn: String::new(),
|
||||
admin_password: String::new(),
|
||||
ldap_user_dn: String::new(),
|
||||
ldap_user_pass: String::new(),
|
||||
database_url: String::from("sqlite://users.db?mode=rwc"),
|
||||
verbose: false,
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ impl<Backend: BackendHandler> LdapHandler<Backend> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::domain::handler::MockTestBackendHandler;
|
||||
use mockall::{mock, predicate::*};
|
||||
use mockall::predicate::eq;
|
||||
|
||||
#[test]
|
||||
fn test_bind() {
|
||||
|
@ -10,7 +10,7 @@ mod infra;
|
||||
async fn run_server(config: Configuration) -> Result<()> {
|
||||
let sql_pool = AnyPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect("sqlite://users.db?mode=rwc")
|
||||
.connect(&config.database_url)
|
||||
.await?;
|
||||
let backend_handler = domain::handler::SqlBackendHandler::new(config.clone(), sql_pool.clone());
|
||||
let server_builder = infra::ldap_server::build_ldap_server(
|
||||
|
Loading…
Reference in New Issue
Block a user