1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +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

@@ -22,6 +22,7 @@
use std::sync::Arc;
use axum::{extract::Extension, routing::get, Router};
use mas_axum_utils::UrlBuilder;
use mas_config::{Encrypter, RootConfig};
use mas_email::Mailer;
use mas_jose::StaticKeystore;
@@ -60,13 +61,14 @@ pub fn root(
filter.with(warp::log(module_path!())).boxed()
}
#[must_use]
pub fn router<B: Send + 'static>(
pool: &PgPool,
templates: &Templates,
key_store: &Arc<StaticKeystore>,
encrypter: &Encrypter,
mailer: &Mailer,
config: &RootConfig,
url_builder: &UrlBuilder,
) -> Router<B> {
Router::new()
.route("/", get(self::views::index::get))
@@ -75,5 +77,6 @@ pub fn router<B: Send + 'static>(
.layer(Extension(templates.clone()))
.layer(Extension(key_store.clone()))
.layer(Extension(encrypter.clone()))
.layer(Extension(url_builder.clone()))
.layer(Extension(mailer.clone()))
}