proxmox-backup/src/api2/access/domain.rs

48 lines
1.4 KiB
Rust
Raw Normal View History

use anyhow::{Error};
2020-04-09 09:36:45 +00:00
use serde_json::{json, Value};
2020-04-16 08:01:59 +00:00
use proxmox::api::{api, Permission};
2020-04-09 09:36:45 +00:00
use proxmox::api::router::Router;
use crate::api2::types::*;
#[api(
returns: {
description: "List of realms.",
type: Array,
items: {
type: Object,
description: "User configuration (without password).",
properties: {
realm: {
description: "Realm ID.",
type: String,
},
comment: {
schema: SINGLE_LINE_COMMENT_SCHEMA,
optional: true,
},
default: {
description: "Default realm.",
type: bool,
}
2020-04-09 09:36:45 +00:00
},
}
2020-04-16 08:01:59 +00:00
},
access: {
description: "Anyone can access this, because we need that list for the login box (before the user is authenticated).",
permission: &Permission::World,
2020-04-09 09:36:45 +00:00
}
)]
/// 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 }));
2020-04-09 09:36:45 +00:00
list.push(json!({ "realm": "pbs", "comment": "Proxmox Backup authentication server" }));
Ok(list.into())
}
pub const ROUTER: Router = Router::new()
.get(&API_METHOD_LIST_DOMAINS);