frontend: Move oidc configuration to dedicated section

This commit is contained in:
Lennart
2025-04-20 20:42:24 +02:00
parent cd0ebc574a
commit 678d2291e0
10 changed files with 98 additions and 98 deletions

View File

@@ -5,7 +5,7 @@ use actix_web::{App, web};
use rustical_caldav::caldav_service;
use rustical_carddav::carddav_service;
use rustical_frontend::nextcloud_login::{NextcloudFlows, configure_nextcloud_login};
use rustical_frontend::{FrontendConfig, configure_frontend};
use rustical_frontend::{FrontendConfig, OidcConfig, configure_frontend};
use rustical_store::auth::AuthenticationProvider;
use rustical_store::{AddressbookStore, CalendarStore, SubscriptionStore};
use std::sync::Arc;
@@ -13,12 +13,14 @@ use tracing_actix_web::TracingLogger;
use crate::config::NextcloudLoginConfig;
#[allow(clippy::too_many_arguments)]
pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
addr_store: Arc<AS>,
cal_store: Arc<CS>,
subscription_store: Arc<S>,
auth_provider: Arc<impl AuthenticationProvider>,
frontend_config: FrontendConfig,
oidc_config: Option<OidcConfig>,
nextcloud_login_config: NextcloudLoginConfig,
nextcloud_flows_state: Arc<NextcloudFlows>,
) -> App<
@@ -70,6 +72,7 @@ pub fn make_app<AS: AddressbookStore, CS: CalendarStore, S: SubscriptionStore>(
cal_store.clone(),
addr_store.clone(),
frontend_config,
oidc_config,
)
}))
.service(web::redirect("/", "/frontend").see_other());

View File

@@ -37,9 +37,9 @@ pub fn cmd_gen_config(_args: GenConfigArgs) -> anyhow::Result<()> {
frontend: FrontendConfig {
secret_key: generate_frontend_secret(),
enabled: true,
oidc: None,
allow_password_login: true,
},
oidc: None,
dav_push: DavPushConfig::default(),
nextcloud_login: Default::default(),
};

View File

@@ -1,4 +1,4 @@
use rustical_frontend::FrontendConfig;
use rustical_frontend::{FrontendConfig, OidcConfig};
use rustical_store::auth::TomlUserStoreConfig;
use serde::{Deserialize, Serialize};
@@ -84,6 +84,8 @@ pub struct Config {
pub http: HttpConfig,
pub frontend: FrontendConfig,
#[serde(default)]
pub oidc: Option<OidcConfig>,
#[serde(default)]
pub tracing: TracingConfig,
#[serde(default)]
pub dav_push: DavPushConfig,

View File

@@ -108,6 +108,7 @@ async fn main() -> Result<()> {
subscription_store.clone(),
user_store.clone(),
config.frontend.clone(),
config.oidc.clone(),
config.nextcloud_login.clone(),
nextcloud_flows.clone(),
)
@@ -221,9 +222,9 @@ mod tests {
FrontendConfig {
enabled: false,
secret_key: generate_frontend_secret(),
oidc: None,
allow_password_login: false,
},
None,
NextcloudLoginConfig { enabled: false },
Arc::new(NextcloudFlows::default()),
);