public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [PATCH yew-comp 2/2] fix #8175: http client: allow different userids in tickets for PMG
Date: Fri, 16 Oct 2026 14:31:08 +0200	[thread overview]
Message-ID: <20261016123124.2970062-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261016123124.2970062-1-d.csapak@proxmox.com>

In PMG's quarantine, the userid supplied is not the one returned by the
ticket (e.g. an alias in LDAP or simply the '@quarantine' suffix). Use
the new 'ignore_userid' flag in proxmox-login to disable the userid
check there, but only for PMG.

By providing a default implementation (that keeps the default behavior),
it isn't necessary to adapt any other projects.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/http_client_wasm.rs | 10 ++++++++--
 src/proxmox_product.rs  | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/http_client_wasm.rs b/src/http_client_wasm.rs
index c8bdecf..53423d4 100644
--- a/src/http_client_wasm.rs
+++ b/src/http_client_wasm.rs
@@ -134,7 +134,10 @@ impl HttpClientWasm {
         let username = username.into();
         let password = password.into();
 
-        let login = Login::new("", username, password);
+        let mut login = Login::new("", username, password);
+        if self.project.ticket_ignore_userid() {
+            login.ignore_userid();
+        }
         let request = login.request();
         let request =
             Self::post_request_builder(&request.url, request.content_type, &request.body)?;
@@ -146,7 +149,10 @@ impl HttpClientWasm {
     pub async fn refresh(&self, username: impl Into<String>) -> Result<TicketResult, Error> {
         let username = username.into();
 
-        let login = Login::renew_with_cookie("", username);
+        let mut login = Login::renew_with_cookie("", username);
+        if self.project.ticket_ignore_userid() {
+            login.ignore_userid();
+        }
         let request = login.request();
         let request =
             Self::post_request_builder(&request.url, request.content_type, &request.body)?;
diff --git a/src/proxmox_product.rs b/src/proxmox_product.rs
index 0e81cc8..8267039 100644
--- a/src/proxmox_product.rs
+++ b/src/proxmox_product.rs
@@ -20,6 +20,12 @@ pub trait ProjectInfo {
     fn subscription_url(&self) -> &'static str {
         ""
     }
+
+    /// Returns if the product needs to ignore mismatching userids in tickets.
+    /// This is useful when doing LDAP login with email aliases (like in the PMG quarantine)
+    fn ticket_ignore_userid(&self) -> bool {
+        false
+    }
 }
 
 /// Enumerate the different Proxmox products.
@@ -76,4 +82,8 @@ impl ProjectInfo for ExistingProduct {
     fn subscription_url(&self) -> &'static str {
         "/nodes/localhost/subscription"
     }
+
+    fn ticket_ignore_userid(&self) -> bool {
+        matches!(self, ExistingProduct::PMG)
+    }
 }
-- 
2.47.3





      parent reply	other threads:[~2026-10-16 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 12:31 [PATCH proxmox/yew-comp 0/2] fix #8175: allow LDAP alias in pmgs mobile quarantine interface Dominik Csapak
2026-10-16 12:31 ` [PATCH proxmox 1/2] login: add option to allow arbitrary userids in tickets Dominik Csapak
2026-10-16 12:31 ` Dominik Csapak [this message]

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=20261016123124.2970062-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-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