server/rest: add ApiAuth trait to make user auth generic
This allows switching the base user identification/authentication method in the rest server. Will initially be used for single file restore VMs, where authentication is based on a ticket file, not the PBS user backend (PAM/local). To avoid putting generic types into the RestServer type for this, we merge the two calls "extract_auth_data" and "check_auth" into a single one, which can use whatever type it wants internally. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
9fe3358ce6
commit
26858dba84
@ -6,8 +6,11 @@ use proxmox::api::RpcEnvironmentType;
|
||||
|
||||
//use proxmox_backup::tools;
|
||||
//use proxmox_backup::api_schema::config::*;
|
||||
use proxmox_backup::server::rest::*;
|
||||
use proxmox_backup::server;
|
||||
use proxmox_backup::server::{
|
||||
self,
|
||||
auth::default_api_auth,
|
||||
rest::*,
|
||||
};
|
||||
use proxmox_backup::tools::daemon;
|
||||
use proxmox_backup::auth_helpers::*;
|
||||
use proxmox_backup::config;
|
||||
@ -53,7 +56,11 @@ async fn run() -> Result<(), Error> {
|
||||
let _ = csrf_secret(); // load with lazy_static
|
||||
|
||||
let mut config = server::ApiConfig::new(
|
||||
buildcfg::JS_DIR, &proxmox_backup::api2::ROUTER, RpcEnvironmentType::PRIVILEGED)?;
|
||||
buildcfg::JS_DIR,
|
||||
&proxmox_backup::api2::ROUTER,
|
||||
RpcEnvironmentType::PRIVILEGED,
|
||||
default_api_auth(),
|
||||
)?;
|
||||
|
||||
let mut commando_sock = server::CommandoSocket::new(server::our_ctrl_sock());
|
||||
|
||||
|
Reference in New Issue
Block a user