Use correct lldap url

This commit is contained in:
Dreaded_X 2025-03-16 05:32:03 +01:00
parent 5e8e8590f1
commit 6d4ba86149
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4

View File

@ -81,16 +81,26 @@ impl LldapConfig {
.default_headers(headers) .default_headers(headers)
.build()?; .build()?;
Ok(LldapClient(client)) Ok(LldapClient {
client,
url: self.url.clone(),
})
} }
} }
pub struct LldapClient(reqwest::Client); pub struct LldapClient {
client: reqwest::Client,
url: String,
}
impl LldapClient { impl LldapClient {
pub async fn list_users(&self) -> Result<impl Iterator<Item = String>> { pub async fn list_users(&self) -> Result<impl Iterator<Item = String>> {
let operation = ListUsers::build(()); let operation = ListUsers::build(());
let response = self.0.post("/api/graphql").run_graphql(operation).await?; let response = self
.client
.post(format!("{}/api/graphql", self.url))
.run_graphql(operation)
.await?;
check_graphql_errors(&response)?; check_graphql_errors(&response)?;
@ -106,7 +116,11 @@ impl LldapClient {
let operation = CreateUser::build(CreateUserVariables { id: username }); let operation = CreateUser::build(CreateUserVariables { id: username });
// TODO: Check the response? // TODO: Check the response?
let response = self.0.post("/api/graphql").run_graphql(operation).await?; let response = self
.client
.post(format!("{}/api/graphql", self.url))
.run_graphql(operation)
.await?;
check_graphql_errors(&response) check_graphql_errors(&response)
} }
@ -122,8 +136,8 @@ impl LldapClient {
}; };
let response: ServerRegistrationStartResponse = self let response: ServerRegistrationStartResponse = self
.0 .client
.post("/auth/opaque/register/start") .post(format!("{}/auth/opaque/register/start", self.url))
.json(&start_request) .json(&start_request)
.send() .send()
.await? .await?
@ -142,8 +156,8 @@ impl LldapClient {
}; };
let _response = self let _response = self
.0 .client
.post("/auth/opaque/register/finish") .post(format!("{}/auth/opaque/register/finish", self.url))
.json(&request) .json(&request)
.send() .send()
.await?; .await?;