summaryrefslogtreecommitdiff
path: root/src/token/extract/identity.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-22 23:25:24 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-22 23:25:24 -0400
commit01f9f3549c76702fd56e58d44c5180fecddb4bfa (patch)
treee7a64e70975a8b50bc442d28c17161b82c42c63a /src/token/extract/identity.rs
parent214a9e6c1fd729fc2c49eb2a5d41b5651ff5bc61 (diff)
Sort out the naming of the various parts of an identity.
* A `cookie::Identity` (`IdentityCookie`) is a specialized CookieJar for working with identities. * An `Identity` is a token/login pair. I hope for this to be a bit more legible. In service of this, `Login` is no longer extractable. You have to get an identity.
Diffstat (limited to 'src/token/extract/identity.rs')
-rw-r--r--src/token/extract/identity.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/token/extract/identity.rs b/src/token/extract/identity.rs
index 8b3cd94..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,10 +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> {
- let Ok(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 {