1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-06 06:02:40 +03:00

admin: model definition for the OAuth 2.0 sessions

This commit is contained in:
Quentin Gliech
2024-07-30 17:33:54 +02:00
parent 86fbe5c589
commit 19d485a68b
2 changed files with 122 additions and 0 deletions

View File

@@ -64,6 +64,19 @@ impl SessionState {
Self::Finished { .. } => Err(InvalidTransitionError),
}
}
/// Returns the time the session was finished, if any
///
/// Returns `None` if the session is still [`Valid`].
///
/// [`Valid`]: SessionState::Valid
#[must_use]
pub fn finished_at(&self) -> Option<DateTime<Utc>> {
match self {
Self::Valid => None,
Self::Finished { finished_at } => Some(*finished_at),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]