diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-10-27 18:23:34 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-10-28 02:08:11 -0400 |
| commit | be21b088f0d1b591cbd8dcfed1e06f2742a524d0 (patch) | |
| tree | 7b4b006d485c921def8d1f4605257763d218feb6 /src/login/handlers/logout/mod.rs | |
| parent | d66728889105f6f1ef5113d9ceb223e362df0008 (diff) | |
Convert the `Tokens` component into a freestanding struct.
As with the `Setup` component, I've generalized the associated middleware across anything that can provide a `Tokens`, where possible.
Diffstat (limited to 'src/login/handlers/logout/mod.rs')
| -rw-r--r-- | src/login/handlers/logout/mod.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/login/handlers/logout/mod.rs b/src/login/handlers/logout/mod.rs index 73efe73..ce4cb1a 100644 --- a/src/login/handlers/logout/mod.rs +++ b/src/login/handlers/logout/mod.rs @@ -4,25 +4,24 @@ use axum::{ }; use crate::{ - app::App, clock::RequestedAt, empty::Empty, error::{Internal, Unauthorized}, - token::{app, extract::IdentityCookie}, + token::{app, app::Tokens, extract::IdentityCookie}, }; #[cfg(test)] mod test; pub async fn handler( - State(app): State<App>, + State(tokens): State<Tokens>, RequestedAt(now): RequestedAt, identity: IdentityCookie, Json(_): Json<Request>, ) -> Result<(IdentityCookie, Empty), Error> { if let Some(secret) = identity.secret() { - let identity = app.tokens().validate(&secret, &now).await?; - app.tokens().logout(&identity.token).await?; + let identity = tokens.validate(&secret, &now).await?; + tokens.logout(&identity.token).await?; } let identity = identity.clear(); |
