Move auth_backend to util

This commit is contained in:
2025-02-06 11:09:36 -05:00
parent afd8f014b2
commit fac75e1f54
6 changed files with 5 additions and 11 deletions

View File

@ -7,7 +7,7 @@ cfg_if! {
use leptos::server_fn::error::NoCustomError;
use leptos_axum::extract;
use axum_login::AuthSession;
use crate::auth_backend::AuthBackend;
use crate::util::auth_backend::AuthBackend;
}
}

View File

@ -43,7 +43,6 @@ use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "ssr")] {
pub mod auth_backend;
pub mod schema;
}
}

View File

@ -23,7 +23,7 @@ async fn main() {
use axum_login::tower_sessions::SessionManagerLayer;
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
use axum_login::AuthManagerLayerBuilder;
use libretunes::auth_backend::AuthBackend;
use libretunes::util::auth_backend::AuthBackend;
use log::*;
flexi_logger::Logger::try_with_env_or_str("debug").unwrap().format(flexi_logger::opt_format).start().unwrap();

View File

@ -4,13 +4,8 @@ use leptos::server_fn::error::ServerFnErrorErr;
use crate::models::backend::User;
use cfg_if::cfg_if;
use async_trait::async_trait;
cfg_if! {
if #[cfg(feature = "ssr")] {
use async_trait::async_trait;
}
}
impl AuthUser for User {
type Id = i32;
@ -29,7 +24,6 @@ impl AuthUser for User {
#[derive(Clone)]
pub struct AuthBackend;
#[cfg(feature = "ssr")]
#[async_trait]
impl AuthnBackend for AuthBackend {
type User = User;

View File

@ -6,6 +6,7 @@ cfg_if! {
pub mod require_auth;
pub mod fileserv;
pub mod database;
pub mod auth_backend;
}
}

View File

@ -5,7 +5,7 @@ use axum::middleware::Next;
use axum_login::AuthSession;
use http::StatusCode;
use crate::auth_backend::AuthBackend;
use crate::util::auth_backend::AuthBackend;
use axum::extract::FromRequestParts;