Use DurationSeconds

This commit is contained in:
Olivier 'reivilibre
2025-03-17 10:29:54 +00:00
parent 73d3703fda
commit 3c6f9815dc
2 changed files with 4 additions and 3 deletions

View File

@@ -284,7 +284,7 @@ pub(crate) async fn post(
exp: access_token.expires_at,
expires_in: access_token
.expires_at
.map(|expires_at| expires_at.signed_duration_since(clock.now()).num_seconds()),
.map(|expires_at| expires_at.signed_duration_since(clock.now())),
iat: Some(access_token.created_at),
nbf: Some(access_token.created_at),
sub,
@@ -421,7 +421,7 @@ pub(crate) async fn post(
exp: access_token.expires_at,
expires_in: access_token
.expires_at
.map(|expires_at| expires_at.signed_duration_since(clock.now()).num_seconds()),
.map(|expires_at| expires_at.signed_duration_since(clock.now())),
iat: Some(access_token.created_at),
nbf: Some(access_token.created_at),
sub: Some(user.sub),

View File

@@ -769,7 +769,8 @@ pub struct IntrospectionResponse {
/// Relative timestamp indicating when the token will expire,
/// in seconds from the current instant.
pub expires_in: Option<i64>,
#[serde_as(as = "Option<DurationSeconds<i64>>")]
pub expires_in: Option<Duration>,
/// Timestamp indicating when the token was issued.
#[serde_as(as = "Option<TimestampSeconds>")]