From: Alexander Abraham <a.abraham@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager v2 1/1] fix #5076: Added an "audiences" field for Open ID
Date: Mon, 2 Jun 2025 16:14:58 +0200 [thread overview]
Message-ID: <20250602141458.142000-4-a.abraham@proxmox.com> (raw)
In-Reply-To: <20250602141458.142000-1-a.abraham@proxmox.com>
A field for audiences for OpenId was added for users to supply
Open ID audiences as a space-separated array of strings in their
realm configuration. This array of audiences is then saved in the
realm domains config file.
Signed-off-by: Alexander Abraham <a.abraham@proxmox.com>
---
www/manager6/Parser.js | 27 +++++++++++++++++++++++++++
www/manager6/dc/AuthEditBase.js | 8 ++++++++
www/manager6/dc/AuthEditOpenId.js | 10 +++++++++-
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index 07eb9b17..4868777e 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -1,9 +1,36 @@
// Some configuration values are complex strings - so we need parsers/generators for them.
Ext.define('PVE.Parser', {
+
statics: {
// this class only contains static functions
+ checkKeys: function(obj, subject) {
+ var result = false;
+ for (const [key, _] of Object.entries(obj)) {
+ if (key === subject) {
+ result = true;
+ } else {
+ // Do nothing.
+ }
+ }
+ return result;
+ },
+ parseOpenIdAudiences: function(audiences) {
+ var result = [];
+ var container = [];
+ for (var i = 0; i < audiences.length; i++) {
+ var current = audiences[i];
+ if (current === ' ') {
+ result.push(container.join(''));
+ container = [];
+ } else {
+ container.push(current);
+ }
+ }
+ result.push(container.join(''));
+ return result;
+ },
printACME: function(value) {
if (Ext.isArray(value.domains)) {
value.domains = value.domains.join(';');
diff --git a/www/manager6/dc/AuthEditBase.js b/www/manager6/dc/AuthEditBase.js
index e18fbc3b..0110e191 100644
--- a/www/manager6/dc/AuthEditBase.js
+++ b/www/manager6/dc/AuthEditBase.js
@@ -14,6 +14,14 @@ Ext.define('PVE.panel.AuthBase', {
delete values.port;
}
+ var audiences = [];
+ if (PVE.Parser.checkKeys(values, "audiences")) {
+ audiences = PVE.Parser.parseOpenIdAudiences(values.audiences);
+ console.log(audiences);
+ delete values.audiences;
+ values.audiences = audiences;
+ }
+
if (me.isCreate) {
values.type = me.type;
}
diff --git a/www/manager6/dc/AuthEditOpenId.js b/www/manager6/dc/AuthEditOpenId.js
index 544c0de5..0f4b07a9 100644
--- a/www/manager6/dc/AuthEditOpenId.js
+++ b/www/manager6/dc/AuthEditOpenId.js
@@ -111,6 +111,15 @@ Ext.define('PVE.panel.OpenIDInputPanel', {
deleteEmpty: '{!isCreate}',
},
},
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'audiences',
+ fieldLabel: gettext('Audiences'),
+ submitEmpty: false,
+ cbind: {
+ deleteEmpty: '{!isCreate}',
+ },
+ },
],
initComponent: function() {
@@ -123,4 +132,3 @@ Ext.define('PVE.panel.OpenIDInputPanel', {
me.callParent();
},
});
-
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2025-06-02 14:15 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 ` [pve-devel] [PATCH proxmox v2 1/1] fix #5076: Added logic to handle OIDC audiences Alexander Abraham
2025-06-03 8:39 ` 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 ` Alexander Abraham [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=20250602141458.142000-4-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