1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Axum migration: signed cookies, errors, CSRF tokens, sessions

This commit is contained in:
Quentin Gliech
2022-03-24 17:31:46 +01:00
parent 797257cce7
commit 7c8f8722cd
15 changed files with 760 additions and 70 deletions

View File

@ -43,6 +43,7 @@ mas-storage = { path = "../storage" }
mas-tasks = { path = "../tasks" }
mas-templates = { path = "../templates" }
mas-warp-utils = { path = "../warp-utils" }
mas-axum-utils = { path = "../axum-utils" }
[dev-dependencies]
indoc = "1.0.4"

View File

@ -22,12 +22,12 @@ use anyhow::Context;
use clap::Parser;
use futures::{future::TryFutureExt, stream::TryStreamExt};
use hyper::Server;
use mas_axum_utils::UrlBuilder;
use mas_config::RootConfig;
use mas_email::{MailTransport, Mailer};
use mas_storage::MIGRATOR;
use mas_tasks::TaskQueue;
use mas_templates::Templates;
use tower::{make::Shared, Layer};
use tracing::{error, info};
#[derive(Parser, Debug, Default)]
@ -191,6 +191,11 @@ impl Options {
&config.email.reply_to,
);
let url_builder = UrlBuilder::new(config.http.public_base.clone());
// Explicitely the config to properly zeroize secret keys
drop(config);
// Watch for changes in templates if the --watch flag is present
if self.watch {
let client = watchman_client::Connector::new()
@ -203,11 +208,14 @@ impl Options {
.context("could not watch for templates changes")?;
}
let router =
mas_handlers::router(&pool, &templates, &key_store, &encrypter, &mailer, &config);
// Explicitely the config to properly zeroize secret keys
drop(config);
let router = mas_handlers::router(
&pool,
&templates,
&key_store,
&encrypter,
&mailer,
&url_builder,
);
info!("Listening on http://{}", listener.local_addr().unwrap());