1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Make the access tokens TTL configurable

This commit is contained in:
Quentin Gliech
2023-08-31 16:30:08 +02:00
parent 73d33dfccb
commit bc04860afb
11 changed files with 155 additions and 93 deletions

View File

@@ -48,6 +48,7 @@ use url::Url;
use crate::{
app_state::ErrorWrapper,
passwords::{Hasher, PasswordManager},
site_config::SiteConfig,
upstream_oauth2::cache::MetadataCache,
MatrixHomeserver,
};
@@ -76,6 +77,7 @@ pub(crate) struct TestState {
pub graphql_schema: mas_graphql::Schema,
pub http_client_factory: HttpClientFactory,
pub password_manager: PasswordManager,
pub site_config: SiteConfig,
pub clock: Arc<MockClock>,
pub rng: Arc<Mutex<ChaChaRng>>,
}
@@ -133,6 +135,8 @@ impl TestState {
let http_client_factory = HttpClientFactory::new(10);
let site_config = SiteConfig::default();
let clock = Arc::new(MockClock::default());
let rng = Arc::new(Mutex::new(ChaChaRng::seed_from_u64(42)));
@@ -160,6 +164,7 @@ impl TestState {
graphql_schema,
http_client_factory,
password_manager,
site_config,
clock,
rng,
})
@@ -346,6 +351,12 @@ impl FromRef<TestState> for MetadataCache {
}
}
impl FromRef<TestState> for SiteConfig {
fn from_ref(input: &TestState) -> Self {
input.site_config.clone()
}
}
#[async_trait]
impl FromRequestParts<TestState> for BoxClock {
type Rejection = Infallible;