mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 14:02:29 +00:00
completely rebuilt the auth implementation to support OIDC in the future
This commit is contained in:
@@ -13,7 +13,7 @@ quick-xml = { version = "0.36", features = [
|
||||
"serde-types",
|
||||
"serialize",
|
||||
] }
|
||||
rustical_auth = { path = "../auth/" }
|
||||
rustical_store = { path = "../store/" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
strum = "0.26"
|
||||
itertools = "0.13"
|
||||
|
||||
@@ -3,11 +3,12 @@ use actix_web::web::Path;
|
||||
use actix_web::HttpRequest;
|
||||
use actix_web::HttpResponse;
|
||||
use actix_web::Responder;
|
||||
use rustical_auth::CheckAuthentication;
|
||||
use rustical_store::auth::User;
|
||||
|
||||
pub async fn route_delete<A: CheckAuthentication, R: ResourceService>(
|
||||
pub async fn route_delete<R: ResourceService>(
|
||||
path_components: Path<R::PathComponents>,
|
||||
req: HttpRequest,
|
||||
_user: User,
|
||||
) -> Result<impl Responder, R::Error> {
|
||||
let path_components = path_components.into_inner();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use actix_web::web::{Data, Path};
|
||||
use actix_web::HttpRequest;
|
||||
use derive_more::derive::Deref;
|
||||
use log::debug;
|
||||
use rustical_auth::{AuthInfoExtractor, CheckAuthentication};
|
||||
use rustical_store::auth::User;
|
||||
use serde::Deserialize;
|
||||
|
||||
// This is not the final place for this struct
|
||||
@@ -39,12 +39,12 @@ struct PropfindElement {
|
||||
prop: PropfindType,
|
||||
}
|
||||
|
||||
pub async fn route_propfind<A: CheckAuthentication, R: ResourceService>(
|
||||
pub async fn route_propfind<R: ResourceService>(
|
||||
path_components: Path<R::PathComponents>,
|
||||
body: String,
|
||||
req: HttpRequest,
|
||||
prefix: Data<ServicePrefix>,
|
||||
auth: AuthInfoExtractor<A>,
|
||||
user: User,
|
||||
depth: Depth,
|
||||
) -> Result<
|
||||
MultistatusElement<
|
||||
@@ -86,7 +86,7 @@ pub async fn route_propfind<A: CheckAuthentication, R: ResourceService>(
|
||||
}
|
||||
}
|
||||
|
||||
let resource = resource_service.get_resource(auth.inner.user_id).await?;
|
||||
let resource = resource_service.get_resource(user.id).await?;
|
||||
let response = resource.propfind(&prefix, req.path(), props).await?;
|
||||
|
||||
Ok(MultistatusElement {
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::Error;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::{web::Path, HttpRequest};
|
||||
use log::debug;
|
||||
use rustical_auth::{AuthInfoExtractor, CheckAuthentication};
|
||||
use rustical_store::auth::User;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
|
||||
@@ -47,11 +47,11 @@ struct PropertyupdateElement<T> {
|
||||
operations: Vec<Operation<T>>,
|
||||
}
|
||||
|
||||
pub async fn route_proppatch<A: CheckAuthentication, R: ResourceService>(
|
||||
pub async fn route_proppatch<R: ResourceService>(
|
||||
path: Path<R::PathComponents>,
|
||||
body: String,
|
||||
req: HttpRequest,
|
||||
auth: AuthInfoExtractor<A>,
|
||||
user: User,
|
||||
) -> Result<MultistatusElement<PropstatWrapper<String>, PropstatWrapper<String>>, R::Error> {
|
||||
let path_components = path.into_inner();
|
||||
let href = req.path().to_owned();
|
||||
@@ -75,7 +75,7 @@ pub async fn route_proppatch<A: CheckAuthentication, R: ResourceService>(
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut resource = resource_service.get_resource(auth.inner.user_id).await?;
|
||||
let mut resource = resource_service.get_resource(user.id).await?;
|
||||
|
||||
let mut props_ok = Vec::new();
|
||||
let mut props_conflict = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user