1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Axum migration: /oauth2/keys.json and /.well-known/openid-configuration

This commit is contained in:
Quentin Gliech
2022-03-30 15:28:02 +02:00
parent 9cb5650167
commit 64900ef1d9
8 changed files with 167 additions and 250 deletions

View File

@@ -28,34 +28,16 @@ use axum::{
Router,
};
use mas_axum_utils::UrlBuilder;
use mas_config::{Encrypter, RootConfig};
use mas_config::Encrypter;
use mas_email::Mailer;
use mas_jose::StaticKeystore;
use mas_templates::Templates;
use sqlx::PgPool;
use warp::{filters::BoxedFilter, Filter, Reply};
mod health;
mod oauth2;
mod views;
use self::oauth2::filter as oauth2;
#[must_use]
pub fn root(
pool: &PgPool,
templates: &Templates,
key_store: &Arc<StaticKeystore>,
encrypter: &Encrypter,
config: &RootConfig,
) -> BoxedFilter<(impl Reply,)> {
let oauth2 = oauth2(pool, templates, key_store, encrypter, &config.http);
let filter = oauth2;
filter.with(warp::log(module_path!())).boxed()
}
#[must_use]
pub fn router<B>(
pool: &PgPool,
@@ -96,6 +78,11 @@ where
"/account/emails",
get(self::views::account::emails::get).post(self::views::account::emails::post),
)
.route(
"/.well-known/openid-configuration",
get(self::oauth2::discovery::get),
)
.route("/oauth2/keys.json", get(self::oauth2::keys::get))
.fallback(mas_static_files::Assets)
.layer(Extension(pool.clone()))
.layer(Extension(templates.clone()))