You've already forked authentication-service
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:
@@ -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)]
|
||||
|
Reference in New Issue
Block a user