Add authentication layer

This commit is contained in:
2024-06-29 14:43:56 +02:00
parent 738c53c8b9
commit e1739d9818
26 changed files with 1038 additions and 90 deletions

View File

@ -0,0 +1,25 @@
use crate::app_config::AppConfig;
use actix_web::HttpResponse;
pub async fn secure_home() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/plain")
.body("SolarEnergy secure central backend")
}
#[derive(serde::Serialize)]
struct ServerConfig {
auth_disabled: bool,
}
impl Default for ServerConfig {
fn default() -> Self {
Self {
auth_disabled: AppConfig::get().unsecure_disable_login,
}
}
}
pub async fn config() -> HttpResponse {
HttpResponse::Ok().json(ServerConfig::default())
}