proxmox-rest-server: cleanup, access api_auth using a method
This commit is contained in:
@ -630,8 +630,6 @@ async fn handle_request(
|
||||
|
||||
rpcenv.set_client_ip(Some(*peer));
|
||||
|
||||
let auth = &api.api_auth;
|
||||
|
||||
let delay_unauth_time = std::time::Instant::now() + std::time::Duration::from_millis(3000);
|
||||
let access_forbidden_time = std::time::Instant::now() + std::time::Duration::from_millis(500);
|
||||
|
||||
@ -658,7 +656,7 @@ async fn handle_request(
|
||||
let mut user_info: Box<dyn UserInformation + Send + Sync> = Box::new(EmptyUserInformation {});
|
||||
|
||||
if auth_required {
|
||||
match auth.check_auth(&parts.headers, &method).await {
|
||||
match api.check_auth(&parts.headers, &method).await {
|
||||
Ok((authid, info)) => {
|
||||
rpcenv.set_auth_id(Some(authid));
|
||||
user_info = info;
|
||||
@ -730,7 +728,7 @@ async fn handle_request(
|
||||
|
||||
if comp_len == 0 {
|
||||
let language = extract_lang_header(&parts.headers);
|
||||
match auth.check_auth(&parts.headers, &method).await {
|
||||
match api.check_auth(&parts.headers, &method).await {
|
||||
Ok((auth_id, _user_info)) => {
|
||||
return Ok(api.get_index(Some(auth_id), language, parts).await);
|
||||
}
|
||||
|
Reference in New Issue
Block a user