Breaking changes to auth provider, principal store outsourced to new config file

This commit is contained in:
Lennart
2025-02-09 17:19:08 +01:00
parent a71000ccf7
commit 8948589b09
16 changed files with 137 additions and 133 deletions

View File

@@ -10,7 +10,7 @@ use calendar_set::CalendarSetResourceService;
use principal::{PrincipalResource, PrincipalResourceService};
use rustical_dav::resource::{NamedRoute, ResourceService, ResourceServiceRoute};
use rustical_dav::resources::RootResourceService;
use rustical_store::auth::{AuthenticationMiddleware, AuthenticationProvider, UserStore};
use rustical_store::auth::{AuthenticationMiddleware, AuthenticationProvider};
use rustical_store::{AddressbookStore, CalendarStore, ContactBirthdayStore, SubscriptionStore};
use std::sync::Arc;
use subscription::subscription_resource;
@@ -25,13 +25,11 @@ mod subscription;
pub use error::Error;
pub fn caldav_service<
US: UserStore,
AP: AuthenticationProvider,
AS: AddressbookStore,
C: CalendarStore,
S: SubscriptionStore,
>(
user_store: Arc<US>,
auth_provider: Arc<AP>,
store: Arc<C>,
addr_store: Arc<AS>,
@@ -40,7 +38,7 @@ pub fn caldav_service<
let birthday_store = Arc::new(ContactBirthdayStore::new(addr_store));
web::scope("")
.wrap(AuthenticationMiddleware::new(auth_provider))
.wrap(AuthenticationMiddleware::new(auth_provider.clone()))
.wrap(
ErrorHandlers::new().handler(StatusCode::METHOD_NOT_ALLOWED, |res| {
Ok(ErrorHandlerResponse::Response(
@@ -68,7 +66,7 @@ pub fn caldav_service<
.service(
web::scope("/principal").service(
web::scope("/{principal}")
.service(PrincipalResourceService{store: user_store, home_set: &[
.service(PrincipalResourceService{auth_provider, home_set: &[
("calendar", false), ("birthdays", true)
]}.actix_resource().name(PrincipalResource::route_name()))
.service(web::scope("/calendar")