]> git.proxmox.com Git - proxmox-backup.git/blame - src/api2/access/domain.rs
src/config/cached_user_info.rs: new helper class
[proxmox-backup.git] / src / api2 / access / domain.rs
CommitLineData
708db4b3
DM
1use failure::*;
2
3use serde_json::{json, Value};
4
5use proxmox::api::api;
6use proxmox::api::router::Router;
7
8use crate::api2::types::*;
9
10#[api(
11 returns: {
12 description: "List of realms.",
13 type: Array,
14 items: {
15 type: Object,
16 description: "User configuration (without password).",
17 properties: {
18 realm: {
19 description: "Realm ID.",
20 type: String,
21 },
22 comment: {
23 schema: SINGLE_LINE_COMMENT_SCHEMA,
24 optional: true,
25 },
879546af
DM
26 default: {
27 description: "Default realm.",
28 type: bool,
29 }
708db4b3
DM
30 },
31 }
32 }
33)]
34/// Authentication domain/realm index.
35///
36/// Anyone can access this, because we need that list for the login
37/// box (before the user is authenticated).
38fn list_domains() -> Result<Value, Error> {
39 let mut list = Vec::new();
879546af 40 list.push(json!({ "realm": "pam", "comment": "Linux PAM standard authentication", "default": true }));
708db4b3
DM
41 list.push(json!({ "realm": "pbs", "comment": "Proxmox Backup authentication server" }));
42 Ok(list.into())
43}
44
45pub const ROUTER: Router = Router::new()
46 .get(&API_METHOD_LIST_DOMAINS);