From 8f8fa99d8e7e6212ed29cc3ae584a32917c791c5 Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Sat, 16 Mar 2024 00:00:31 +0100 Subject: [PATCH] refactor auth --- crates/auth/src/extractor.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/auth/src/extractor.rs b/crates/auth/src/extractor.rs index 877a84f..8959633 100644 --- a/crates/auth/src/extractor.rs +++ b/crates/auth/src/extractor.rs @@ -8,6 +8,7 @@ use crate::error::Error; use super::{AuthInfo, CheckAuthentication}; +#[derive(Clone)] pub struct AuthInfoExtractor { pub inner: AuthInfo, pub _provider_type: PhantomData, @@ -29,14 +30,11 @@ where type Error = Error; type Future = Ready>; - fn extract(req: &HttpRequest) -> Self::Future { + fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future { let result = req.app_data::>().unwrap().validate(req); ready(result.map(|auth_info| Self { inner: auth_info, _provider_type: PhantomData, })) } - fn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future { - Self::extract(req) - } }