diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-10-23 21:56:31 -0400 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-10-23 21:56:31 -0400 |
| commit | 1f769855df2d9cf2bca883a0475670f227e3678b (patch) | |
| tree | 6c94d9c868eb022588a07245df978478034ac5dd /src/token/extract/identity.rs | |
| parent | 8f360dd9cc45bb14431238ccc5e3d137c020fa7b (diff) | |
| parent | 461814e5174cef1be3e07b4e4069314e9bcbedd6 (diff) | |
Merge branch 'main' into wip/mobile
Diffstat (limited to 'src/token/extract/identity.rs')
| -rw-r--r-- | src/token/extract/identity.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/token/extract/identity.rs b/src/token/extract/identity.rs index 60ad220..a69f509 100644 --- a/src/token/extract/identity.rs +++ b/src/token/extract/identity.rs @@ -4,7 +4,7 @@ use axum::{ response::{IntoResponse, Response}, }; -use super::IdentityToken; +use super::IdentityCookie; use crate::{ app::App, @@ -25,19 +25,10 @@ impl FromRequestParts<App> for Identity { type Rejection = LoginError<Internal>; async fn from_request_parts(parts: &mut Parts, state: &App) -> Result<Self, Self::Rejection> { - // After Rust 1.82 (and #[feature(min_exhaustive_patterns)] lands on - // stable), the following can be replaced: - // - // ``` - // let Ok(identity_token) = IdentityToken::from_request_parts( - // parts, - // state, - // ).await; - // ``` - let identity_token = IdentityToken::from_request_parts(parts, state).await?; + let Ok(cookie) = IdentityCookie::from_request_parts(parts, state).await; let RequestedAt(used_at) = RequestedAt::from_request_parts(parts, state).await?; - let secret = identity_token.secret().ok_or(LoginError::Unauthorized)?; + let secret = cookie.secret().ok_or(LoginError::Unauthorized)?; let app = State::<App>::from_request_parts(parts, state).await?; match app.tokens().validate(&secret, &used_at).await { |
