mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 07:02:24 +00:00
completely rebuilt the auth implementation to support OIDC in the future
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use rustical_auth::{AuthProvider, HtpasswdAuthConfig};
|
||||
use rustical_frontend::FrontendConfig;
|
||||
use rustical_store::auth::StaticUserStoreConfig;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@@ -21,19 +22,7 @@ pub enum CalendarStoreConfig {
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(tag = "backend", rename_all = "snake_case")]
|
||||
pub enum AuthConfig {
|
||||
Htpasswd(HtpasswdAuthConfig),
|
||||
None,
|
||||
}
|
||||
|
||||
impl From<AuthConfig> for AuthProvider {
|
||||
fn from(value: AuthConfig) -> Self {
|
||||
match value {
|
||||
AuthConfig::Htpasswd(config) => {
|
||||
Self::Htpasswd(rustical_auth::htpasswd::HtpasswdAuth { config })
|
||||
}
|
||||
AuthConfig::None => Self::None(rustical_auth::none::NoneAuth),
|
||||
}
|
||||
}
|
||||
Static(StaticUserStoreConfig),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@@ -41,4 +30,5 @@ pub struct Config {
|
||||
pub calendar_store: CalendarStoreConfig,
|
||||
pub auth: AuthConfig,
|
||||
pub http: HttpConfig,
|
||||
pub frontend: FrontendConfig,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user