From: Christian Ebner <c.ebner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox 2/3] proxmox-client: adapt to new compat mode introduced for proxmox-login
Date: Mon, 29 Sep 2025 17:48:16 +0200 [thread overview]
Message-ID: <20250929154820.892720-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250929154820.892720-1-c.ebner@proxmox.com>
The API for setting the compatibility changed to allow for easier
extension. Adapt the client to the new interface and expose the same
changes to the client.
Also, re-export the `CompatMode` so users do not need to directly
depend on the implementation in proxmox-login.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
proxmox-client/src/client.rs | 12 ++++++------
proxmox-client/src/lib.rs | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/proxmox-client/src/client.rs b/proxmox-client/src/client.rs
index da2c5c59..894d9216 100644
--- a/proxmox-client/src/client.rs
+++ b/proxmox-client/src/client.rs
@@ -17,7 +17,7 @@ use serde::Serialize;
use proxmox_http::Body;
use proxmox_login::ticket::Validity;
-use proxmox_login::{Login, SecondFactorChallenge, TicketResult};
+use proxmox_login::{CompatMode, Login, SecondFactorChallenge, TicketResult};
use crate::auth::AuthenticationKind;
use crate::error::ParseFingerprintError;
@@ -68,7 +68,7 @@ pub struct Client {
api_url: Uri,
auth: Mutex<Option<Arc<AuthenticationKind>>>,
client: Arc<proxmox_http::client::Client>,
- pve_compat: bool,
+ compat_mode: CompatMode,
cookie_name: Option<String>,
}
@@ -91,7 +91,7 @@ impl Client {
api_url,
auth: Mutex::new(None),
client,
- pve_compat: false,
+ compat_mode: CompatMode::default(),
cookie_name: None,
}
}
@@ -181,8 +181,8 @@ impl Client {
/// Enable Proxmox VE login API compatibility. This is required to support TFA authentication
/// on Proxmox VE APIs which require the `new-format` option.
- pub fn set_pve_compatibility(&mut self, compatibility: bool) {
- self.pve_compat = compatibility;
+ pub fn set_compatibility(&mut self, compat_mode: CompatMode) {
+ self.compat_mode = compat_mode;
}
pub fn set_cookie_name(&mut self, cookie_name: &str) {
@@ -418,7 +418,7 @@ impl Client {
/// If the authentication is complete, `None` is returned and the authentication state updated.
/// If a 2nd factor is required, `Some` is returned.
pub async fn login(&self, login: Login) -> Result<Option<SecondFactorChallenge>, Error> {
- let login = login.pve_compatibility(self.pve_compat);
+ let login = login.set_compatibility(self.compat_mode);
let (ticket, api_response) = self.do_login_request(login.request()).await?;
diff --git a/proxmox-client/src/lib.rs b/proxmox-client/src/lib.rs
index f1df1e1d..3bac1333 100644
--- a/proxmox-client/src/lib.rs
+++ b/proxmox-client/src/lib.rs
@@ -12,7 +12,7 @@ mod error;
pub use error::Error;
pub use proxmox_login::tfa::TfaChallenge;
-pub use proxmox_login::{Authentication, Ticket};
+pub use proxmox_login::{CompatMode, Authentication, Ticket};
mod api_path_builder;
pub use api_path_builder::ApiPathBuilder;
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-09-29 15:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 15:48 [pdm-devel] [PATCH datacenter-manager/proxmox 0/6] pbs client: fix PBS version 3 login ticket parsing compatibility Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH proxmox 1/3] proxmox-login: refactor PVE TFA compat mode Christian Ebner
2025-09-29 15:48 ` Christian Ebner [this message]
2025-09-29 15:48 ` [pdm-devel] [PATCH proxmox 3/3] proxmox-login: add compat mode to fallback to PBS3 ticket parsing Christian Ebner
2025-09-29 18:01 ` Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH datacenter-manager 1/3] server: adapt to proxmox-client compat mode changes Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH datacenter-manager 2/3] server: pbs-client: check and fallback to PBS v3 ticket compat mode Christian Ebner
2025-09-29 15:48 ` [pdm-devel] [PATCH datacenter-manager 3/3] Revert "ui: add wizard: note that login currently only works for PBS 4" Christian Ebner
2025-09-30 8:03 ` [pdm-devel] superseded: [PATCH datacenter-manager/proxmox 0/6] pbs client: fix PBS version 3 login ticket parsing compatibility Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250929154820.892720-3-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.