public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox 3/3] proxmox-login: add compat mode to fallback to PBS3 ticket parsing
Date: Mon, 29 Sep 2025 17:48:17 +0200	[thread overview]
Message-ID: <20250929154820.892720-4-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250929154820.892720-1-c.ebner@proxmox.com>

The ticket info field is present for Proxmox Backup Server version 3
login response data, the client however switches to http-only in this
case.

Allow to use the old authentication workflow instead by extending the
compat mode by `Pbs3Ticket`, resulting in a full ticket instead of
the http-only one.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 proxmox-login/src/lib.rs | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/proxmox-login/src/lib.rs b/proxmox-login/src/lib.rs
index e7b8e023..93d09a8c 100644
--- a/proxmox-login/src/lib.rs
+++ b/proxmox-login/src/lib.rs
@@ -58,6 +58,7 @@ pub enum CompatMode {
     #[default]
     Generic,
     PveTfa,
+    Pbs3Ticket,
 }
 
 fn normalize_url(mut api_url: String) -> String {
@@ -216,15 +217,17 @@ impl Login {
             ));
         }
 
-        // `ticket_info` is set when the server sets the ticket via an HttpOnly cookie. this also
-        // means we do not have access to the cookie itself which happens for example in a browser.
-        // assume that the cookie is handled properly by the context (browser) and don't worry
-        // about handling it ourselves.
-        if let Some(ref ticket) = response.ticket_info {
-            let ticket = ticket.parse()?;
-            return Ok(TicketResult::HttpOnly(
-                self.authentication_for(ticket, response)?,
-            ));
+        if self.compat_mode == CompatMode::Pbs3Ticket {
+            // `ticket_info` is set when the server sets the ticket via an HttpOnly cookie. this also
+            // means we do not have access to the cookie itself which happens for example in a browser.
+            // assume that the cookie is handled properly by the context (browser) and don't worry
+            // about handling it ourselves.
+            if let Some(ref ticket) = response.ticket_info {
+                let ticket = ticket.parse()?;
+                return Ok(TicketResult::HttpOnly(
+                    self.authentication_for(ticket, response)?,
+                ));
+            }
         }
 
         // old authentication flow where we needed to handle the ticket ourselves even in the
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  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 ` [pdm-devel] [PATCH proxmox 2/3] proxmox-client: adapt to new compat mode introduced for proxmox-login Christian Ebner
2025-09-29 15:48 ` Christian Ebner [this message]
2025-09-29 18:01   ` [pdm-devel] [PATCH proxmox 3/3] proxmox-login: add compat mode to fallback to PBS3 ticket parsing 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-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal