login & logout

This commit is contained in:
2026-02-27 23:46:37 +01:00
parent 969401658f
commit b6a211bbcf
3 changed files with 84 additions and 42 deletions

View File

@@ -1,7 +1,10 @@
use axum::http::HeaderMap;
use rand08::{RngCore, rngs::OsRng};
use crate::users::{User, UserError, sessions::SessionError};
use crate::users::{
User, UserError,
sessions::{Session, SessionError},
};
pub mod implementation;
@@ -13,6 +16,12 @@ pub trait UserAuthenticate {
pub trait UserAuthRequired {
fn required(self) -> Result<User, AuthError>;
}
pub trait SessionAuthenticate {
fn authenticate(headers: &HeaderMap) -> Result<Option<Session>, AuthError>;
}
pub trait SessionAuthRequired {
fn required(self) -> Result<Session, AuthError>;
}
pub trait UserPasswordHashing {
/// Returns the hashed password as a String