summaryrefslogtreecommitdiffstats
path: root/src/routes/login.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-04-08 16:31:44 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-04-11 23:49:41 -0500
commitd9ed52fc239e3547eb99fe03bd296ab2808d2ebc (patch)
tree2fdc8a0e33bdf0902f608daa8e41d61df80ea9b2 /src/routes/login.rs
parent9a6c04d52edb10431f9f5ca2dbc83c410cb5daee (diff)
wip: impl jwt handling
Diffstat (limited to 'src/routes/login.rs')
-rw-r--r--src/routes/login.rs5
1 files changed, 3 insertions, 2 deletions
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)