From d9ed52fc239e3547eb99fe03bd296ab2808d2ebc Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Mon, 8 Apr 2024 16:31:44 -0500 Subject: wip: impl jwt handling --- src/routes/login.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/routes/login.rs') diff --git a/src/routes/login.rs b/src/routes/login.rs index 67f8422..8843bd5 100644 --- a/src/routes/login.rs +++ b/src/routes/login.rs @@ -7,12 +7,13 @@ use serde::Deserialize; use crate::{ error::AuthError, - jwt::Claims, model::{LoginSchema, UserSchema}, state::AppState, Error, }; +use super::jwt::Claims; + #[derive(Debug, Deserialize, TypedPath)] #[typed_path("/api/login")] pub struct Login; @@ -40,7 +41,7 @@ impl Login { Argon2::default() .verify_password(password.as_bytes(), &PasswordHash::new(&password_hash)?)?; - let token = Claims::new(uuid, state.jwt_max_age).encode(state.jwt_secret.as_ref())?; + let token = Claims::from(uuid).encode(state.jwt_secret.as_ref())?; Authorization::bearer(&token) .map(TypedHeader) -- cgit v1.2.3-70-g09d2