1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00

storage: make the access token expiration optional

This commit is contained in:
Quentin Gliech
2023-09-11 11:37:06 +02:00
parent e6b91c1ce4
commit 9c97a0c37a
11 changed files with 36 additions and 41 deletions

View File

@ -13,7 +13,6 @@
// limitations under the License.
use axum::http::Request;
use chrono::Duration;
use hyper::StatusCode;
use mas_data_model::{AccessToken, Client, TokenType, User};
use mas_router::SimpleRoute;
@ -106,13 +105,7 @@ async fn start_oauth_session(
let access_token = repo
.oauth2_access_token()
.add(
&mut rng,
&state.clock,
&session,
access_token_str,
Duration::minutes(5),
)
.add(&mut rng, &state.clock, &session, access_token_str, None)
.await
.unwrap();

View File

@ -115,7 +115,7 @@ pub(crate) async fn generate_token_pair<R: RepositoryAccess>(
let access_token = repo
.oauth2_access_token()
.add(rng, clock, session, access_token_str, ttl)
.add(rng, clock, session, access_token_str, Some(ttl))
.await?;
let refresh_token = repo

View File

@ -529,7 +529,7 @@ async fn client_credentials_grant(
let access_token = repo
.oauth2_access_token()
.add(rng, clock, &session, access_token_str, ttl)
.add(rng, clock, &session, access_token_str, Some(ttl))
.await?;
let mut params = AccessTokenResponse::new(access_token.access_token).with_expires_in(ttl);