aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/src/command/authn.rs
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2022-12-29 00:09:27 -0800
committerbenj <benj@rse8.com>2022-12-29 00:09:27 -0800
commitf0ea9ecd17b03605d747044874a26e1bd52c0ee1 (patch)
treec42b94f530ab64dad19eecdfefc9aa53c08f3097 /crates/secd/src/command/authn.rs
parentc2268c285648ef02ece04de0d9df0813c6d70ff8 (diff)
downloadsecdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar.gz
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar.bz2
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar.lz
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar.xz
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.tar.zst
secdiam-f0ea9ecd17b03605d747044874a26e1bd52c0ee1.zip
revoke session (+ some cleanup)
Diffstat (limited to '')
-rw-r--r--crates/secd/src/command/authn.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/secd/src/command/authn.rs b/crates/secd/src/command/authn.rs
index 5590e8c..1d3b2d5 100644
--- a/crates/secd/src/command/authn.rs
+++ b/crates/secd/src/command/authn.rs
@@ -8,8 +8,8 @@ use crate::{
},
},
util, Address, AddressType, AddressValidation, AddressValidationId, AddressValidationMethod,
- Credential, CredentialType, Identity, IdentityId, PhoneNumber, Secd, SecdError, Session,
- SessionToken, ADDRESSS_VALIDATION_CODE_SIZE, ADDRESS_VALIDATION_ALLOWS_ATTEMPTS,
+ Credential, CredentialType, Identity, PhoneNumber, Secd, SecdError, Session, SessionToken,
+ ADDRESSS_VALIDATION_CODE_SIZE, ADDRESS_VALIDATION_ALLOWS_ATTEMPTS,
ADDRESS_VALIDATION_IDENTITY_SURJECTION, EMAIL_VALIDATION_DURATION,
};
use email_address::EmailAddress;
@@ -278,4 +278,10 @@ impl Secd {
Ok(i.swap_remove(0))
}
}
+
+ pub async fn revoke_session(&self, session: &mut Session) -> Result<(), SecdError> {
+ session.revoked_at = Some(OffsetDateTime::now_utc());
+ session.write(self.store.clone()).await?;
+ Ok(())
+ }
}