From: Alexander Abraham <a.abraham@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox v2 1/1] fix #5076: Added logic to handle OIDC audiences
Date: Mon, 2 Jun 2025 16:14:56 +0200 [thread overview]
Message-ID: <20250602141458.142000-2-a.abraham@proxmox.com> (raw)
In-Reply-To: <20250602141458.142000-1-a.abraham@proxmox.com>
A field for OIDC audiences was added, logic to handle these audiences,
and the audiences supplied by an OIDC IDP are validated against
the audiences a user saves in their realm domains
configuration.
Signed-off-by: Alexander Abraham <a.abraham@proxmox.com>
---
proxmox-openid/src/lib.rs | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/proxmox-openid/src/lib.rs b/proxmox-openid/src/lib.rs
index fe65fded..fa22638a 100644
--- a/proxmox-openid/src/lib.rs
+++ b/proxmox-openid/src/lib.rs
@@ -53,6 +53,8 @@ pub struct OpenIdConfig {
pub prompt: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub acr_values: Option<Vec<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub audiences: Option<Vec<String>>,
}
pub struct OpenIdAuthenticator {
@@ -205,12 +207,26 @@ impl OpenIdAuthenticator {
.request(http_client)
.map_err(|err| format_err!("Failed to contact token endpoint: {}", err))?;
- let id_token_verifier: CoreIdTokenVerifier = self.client.id_token_verifier();
let id_token_claims: &CoreIdTokenClaims = token_response
.extra_fields()
.id_token()
.expect("Server did not return an ID token")
- .claims(&id_token_verifier, &private_auth_state.nonce)
+ .claims(
+ &((self.client.id_token_verifier())
+ .require_audience_match(true)
+ .set_other_audience_verifier_fn(|aud| {
+ let curr_aud: &String = aud;
+ if &self.config.client_id == curr_aud {
+ true
+ } else {
+ match self.config.audiences.as_ref() {
+ Some(confd_auds) => confd_auds.contains(curr_aud),
+ None => false,
+ }
+ }
+ })),
+ &private_auth_state.nonce,
+ )
.map_err(|err| format_err!("Failed to verify ID token: {}", err))?;
let userinfo_claims: GenericUserInfoClaims = self
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-06-02 14:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 14:14 [pve-devel] [PATCH access-control-5076/manager/proxmox-5076 v2 0/3] fix #5076: Added Open ID audiences Alexander Abraham
2025-06-02 14:14 ` Alexander Abraham [this message]
2025-06-03 8:39 ` [pve-devel] [PATCH proxmox v2 1/1] fix #5076: Added logic to handle OIDC audiences Shannon Sterz
2025-06-02 14:14 ` [pve-devel] [PATCH pve-access-control v2 1/1] fix #5076: Changed audiences to an array Alexander Abraham
2025-06-02 14:14 ` [pve-devel] [PATCH pve-manager v2 1/1] fix #5076: Added an "audiences" field for Open ID Alexander Abraham
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=20250602141458.142000-2-a.abraham@proxmox.com \
--to=a.abraham@proxmox.com \
--cc=pve-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