1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-26 10:44:51 +03:00

Define upstream OAuth providers in the config

And adds CLI tool to sync them with the database (WIP)
This commit is contained in:
Quentin Gliech
2023-06-22 18:28:34 +02:00
parent 9d5c2a40a1
commit 4f1b201c74
14 changed files with 503 additions and 50 deletions

View File

@@ -65,10 +65,10 @@ fn print_headers(parts: &hyper::http::response::Parts) {
impl Options {
#[tracing::instrument(skip_all)]
pub async fn run(&self, root: &super::Options) -> anyhow::Result<()> {
pub async fn run(self, root: &super::Options) -> anyhow::Result<()> {
use Subcommand as SC;
let http_client_factory = HttpClientFactory::new(10);
match &self.subcommand {
match self.subcommand {
SC::Http {
show_headers,
json: false,
@@ -83,15 +83,13 @@ impl Options {
let response = client.ready().await?.call(request).await?;
let (parts, body) = response.into_parts();
if *show_headers {
if show_headers {
print_headers(&parts);
}
let mut body = hyper::body::aggregate(body).await?;
let mut stdout = tokio::io::stdout();
stdout.write_all_buf(&mut body).await?;
Ok(())
}
SC::Http {
@@ -113,14 +111,12 @@ impl Options {
client.ready().await?.call(request).await?;
let (parts, body) = response.into_parts();
if *show_headers {
if show_headers {
print_headers(&parts);
}
let body = serde_json::to_string_pretty(&body)?;
println!("{body}");
Ok(())
}
SC::Policy => {
@@ -130,8 +126,9 @@ impl Options {
let policy_factory = policy_factory_from_config(&config).await?;
let _instance = policy_factory.instantiate().await?;
Ok(())
}
}
Ok(())
}
}