You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-20 12:02:22 +03:00
Implement private_key_jwks client authentication
This involves a lot of things, including: - better VerifyingKeystore trait - better errors in the JOSE crate - getting rid of async_trait in some JOSE traits
This commit is contained in:
@@ -32,7 +32,7 @@ use warp::{filters::BoxedFilter, Filter, Reply};
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub(super) fn filter(
|
||||
key_store: impl SigningKeystore,
|
||||
key_store: &impl SigningKeystore,
|
||||
http_config: &HttpConfig,
|
||||
) -> BoxedFilter<(Box<dyn Reply>,)> {
|
||||
let builder = UrlBuilder::from(http_config);
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use mas_jose::{ExportJwks, StaticKeystore};
|
||||
use mas_warp_utils::{errors::WrapError, filters};
|
||||
use mas_jose::StaticKeystore;
|
||||
use mas_warp_utils::filters;
|
||||
use tower::{Service, ServiceExt};
|
||||
use warp::{filters::BoxedFilter, Filter, Rejection, Reply};
|
||||
|
||||
pub(super) fn filter(key_store: &Arc<StaticKeystore>) -> BoxedFilter<(Box<dyn Reply>,)> {
|
||||
@@ -27,7 +28,7 @@ pub(super) fn filter(key_store: &Arc<StaticKeystore>) -> BoxedFilter<(Box<dyn Re
|
||||
}
|
||||
|
||||
async fn get(key_store: Arc<StaticKeystore>) -> Result<Box<dyn Reply>, Rejection> {
|
||||
let jwks = key_store.export_jwks().await.wrap_error()?;
|
||||
|
||||
let mut key_store: &StaticKeystore = key_store.as_ref();
|
||||
let jwks = key_store.ready().await?.call(()).await?;
|
||||
Ok(Box::new(warp::reply::json(&jwks)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user