From a734a77520a3f9f0061e44c4fac6c42801730496 Mon Sep 17 00:00:00 2001 From: benj Date: Mon, 12 Dec 2022 23:28:12 -0800 Subject: [secd] expires_at -> expired_at for sessions --- crates/secd/src/client/sqldb.rs | 2 +- crates/secd/src/command/authn.rs | 2 +- crates/secd/src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/secd/src') diff --git a/crates/secd/src/client/sqldb.rs b/crates/secd/src/client/sqldb.rs index 15cc4b5..6751ef6 100644 --- a/crates/secd/src/client/sqldb.rs +++ b/crates/secd/src/client/sqldb.rs @@ -286,7 +286,7 @@ select identity_public_id, data, created_at from identity where identity_public_ .bind(&session.identity_id) .bind(secret_hash.as_ref()) .bind(session.created_at) - .bind(session.expires_at) + .bind(session.expired_at) .bind(session.revoked_at) .execute(&self.pool) .await diff --git a/crates/secd/src/command/authn.rs b/crates/secd/src/command/authn.rs index 862d921..b254614 100644 --- a/crates/secd/src/command/authn.rs +++ b/crates/secd/src/command/authn.rs @@ -214,7 +214,7 @@ impl Secd { identity_id: identity.id, secret: Some(Alphanumeric.sample_string(&mut rand::thread_rng(), SESSION_SIZE_BYTES)), created_at: now, - expires_at: now + expired_at: now .checked_add(Duration::new(SESSION_DURATION, 0)) .ok_or(SecdError::SessionExpiryOverflow)?, revoked_at: None, diff --git a/crates/secd/src/lib.rs b/crates/secd/src/lib.rs index faa92ca..17186c8 100644 --- a/crates/secd/src/lib.rs +++ b/crates/secd/src/lib.rs @@ -55,7 +55,7 @@ pub struct Session { #[serde(with = "time::serde::timestamp")] pub created_at: OffsetDateTime, #[serde(with = "time::serde::timestamp")] - pub expires_at: OffsetDateTime, + pub expired_at: OffsetDateTime, #[serde(skip_serializing_if = "Option::is_none")] pub revoked_at: Option, } @@ -318,7 +318,7 @@ impl Secd { ) -> Result { match self.store.read_session(&secret).await { Ok(session) - if session.expires_at > OffsetDateTime::now_utc() + if session.expired_at > OffsetDateTime::now_utc() || session.revoked_at > Some(OffsetDateTime::now_utc()) => { Ok(Authorization { session }) -- cgit v1.2.3