Implement federated login; #123

This commit is contained in:
NG (Graham) authored and NGnius committed 2026-07-05 20:38:17 +00:00
1 parent 6601c188d0
commit 2adf8249bb
35 files changed
+1466 -121

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ oj_rc_core = { version = "*", path = "../rc_core" }
oj_rc_plugins = { version = "*", path = "../rc_plugins" }
oj_rc_factory = { version = "*", path = "../rc_factory" }
oj_convert.workspace = true
oj_serdes.workspace = true
libfj.workspace = true
git-version.workspace = true
serde.workspace = true
+2
View File
@@ -1,6 +1,8 @@
pub mod garage;
pub mod config;
pub mod urls;
pub fn init(config: &dyn oj_rc_core::ConfigProvider<()>) {
config::init(config);
urls::init(config);
}
+25
View File
@@ -0,0 +1,25 @@
use actix_web::{HttpResponse, Responder, get, http::header::ContentType};
static JSON_DATA: std::sync::OnceLock<String> = std::sync::OnceLock::new();
pub(super) fn init(config: &dyn oj_rc_core::ConfigProvider<()>) {
JSON_DATA.get_or_init(|| {
let urls = config.server_config();
let data = oj_serdes::society::ServiceDomains {
root: urls.domain,
auth: urls.auth_url,
cdn: urls.cdn_url,
factory: urls.factory_url,
society: urls.society_url,
};
serde_json::to_string(&data).expect("ServiceDomains did not serialize")
});
}
#[get("/api/v1/services.json")]
pub async fn get() -> impl Responder {
let data = JSON_DATA.get().expect("ServiceDomains JSON init failure").to_owned();
HttpResponse::Ok()
.insert_header(ContentType::json())
.body(data)
}
+1
View File
@@ -104,6 +104,7 @@ async fn main() -> std::io::Result<()> {
.service(web::user_federation::post_off)
.service(web::user_federation::post_on)
.service(api::config::get)
.service(api::urls::get)
})
.bind((cli_args.ip, cli_args.port))?
.run()