You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
storage-pg: write tests for the OAuth2 repositories
This commit is contained in:
@ -120,6 +120,22 @@ impl AuthorizationGrantStage {
|
||||
pub fn is_pending(&self) -> bool {
|
||||
matches!(self, Self::Pending)
|
||||
}
|
||||
|
||||
/// Returns `true` if the authorization grant stage is [`Fulfilled`].
|
||||
///
|
||||
/// [`Fulfilled`]: AuthorizationGrantStage::Fulfilled
|
||||
#[must_use]
|
||||
pub fn is_fulfilled(&self) -> bool {
|
||||
matches!(self, Self::Fulfilled { .. })
|
||||
}
|
||||
|
||||
/// Returns `true` if the authorization grant stage is [`Exchanged`].
|
||||
///
|
||||
/// [`Exchanged`]: AuthorizationGrantStage::Exchanged
|
||||
#[must_use]
|
||||
pub fn is_exchanged(&self) -> bool {
|
||||
matches!(self, Self::Exchanged { .. })
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
@ -140,6 +156,14 @@ pub struct AuthorizationGrant {
|
||||
pub requires_consent: bool,
|
||||
}
|
||||
|
||||
impl std::ops::Deref for AuthorizationGrant {
|
||||
type Target = AuthorizationGrantStage;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.stage
|
||||
}
|
||||
}
|
||||
|
||||
impl AuthorizationGrant {
|
||||
#[must_use]
|
||||
pub fn max_auth_time(&self) -> DateTime<Utc> {
|
||||
|
Reference in New Issue
Block a user