Use correct lldap url
This commit is contained in:
parent
5e8e8590f1
commit
6d4ba86149
30
src/lldap.rs
30
src/lldap.rs
|
@ -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?;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user