config: new domains.cfg to configure openid realm

Or other realmy types...
This commit is contained in:
Dietmar Maurer
2021-06-11 06:34:37 +02:00
parent bb88c6a29d
commit bbff6c4968
3 changed files with 142 additions and 0 deletions

View File

@ -38,10 +38,31 @@ use crate::api2::types::*;
)]
/// Authentication domain/realm index.
fn list_domains() -> Result<Value, Error> {
let mut list = Vec::new();
list.push(json!({ "realm": "pam", "comment": "Linux PAM standard authentication", "default": true }));
list.push(json!({ "realm": "pbs", "comment": "Proxmox Backup authentication server" }));
let (config, _digest) = crate::config::domains::config()?;
for (realm, (section_type, v)) in config.sections.iter() {
let mut item = json!({
"type": section_type,
"realm": realm,
});
if v["comment"].as_str().is_some() {
item["comment"] = v["comment"].clone();
}
list.push(item);
}
Ok(list.into())
}
pub const ROUTER: Router = Router::new()