rest server: do not use pbs_api_types::Authid
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
98b7d58b94
commit
1b1a553741
|
@ -33,7 +33,6 @@ use proxmox::tools::fs::CreateOptions;
|
||||||
|
|
||||||
use pbs_tools::compression::{DeflateEncoder, Level};
|
use pbs_tools::compression::{DeflateEncoder, Level};
|
||||||
use pbs_tools::stream::AsyncReaderStream;
|
use pbs_tools::stream::AsyncReaderStream;
|
||||||
use pbs_api_types::Authid;
|
|
||||||
use proxmox_rest_server::{
|
use proxmox_rest_server::{
|
||||||
ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment, CompressionMethod,
|
ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment, CompressionMethod,
|
||||||
extract_cookie, normalize_uri_path,
|
extract_cookie, normalize_uri_path,
|
||||||
|
@ -44,6 +43,8 @@ extern "C" {
|
||||||
fn tzset();
|
fn tzset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct AuthStringExtension(String);
|
||||||
|
|
||||||
struct EmptyUserInformation {}
|
struct EmptyUserInformation {}
|
||||||
|
|
||||||
impl UserInformation for EmptyUserInformation {
|
impl UserInformation for EmptyUserInformation {
|
||||||
|
@ -176,8 +177,8 @@ fn log_response(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some(logfile) = logfile {
|
if let Some(logfile) = logfile {
|
||||||
let auth_id = match resp.extensions().get::<Authid>() {
|
let auth_id = match resp.extensions().get::<AuthStringExtension>() {
|
||||||
Some(auth_id) => auth_id.to_string(),
|
Some(AuthStringExtension(auth_id)) => auth_id.clone(),
|
||||||
None => "-".to_string(),
|
None => "-".to_string(),
|
||||||
};
|
};
|
||||||
let now = proxmox::tools::time::epoch_i64();
|
let now = proxmox::tools::time::epoch_i64();
|
||||||
|
@ -198,6 +199,7 @@ fn log_response(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn auth_logger() -> Result<FileLogger, Error> {
|
pub fn auth_logger() -> Result<FileLogger, Error> {
|
||||||
let backup_user = pbs_config::backup_user()?;
|
let backup_user = pbs_config::backup_user()?;
|
||||||
|
|
||||||
|
@ -720,8 +722,7 @@ async fn handle_request(
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(auth_id) = auth_id {
|
if let Some(auth_id) = auth_id {
|
||||||
let auth_id: Authid = auth_id.parse()?;
|
response.extensions_mut().insert(AuthStringExtension(auth_id));
|
||||||
response.extensions_mut().insert(auth_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
|
|
Loading…
Reference in New Issue