all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 4/4] add generic OpenIDInputPanel
Date: Fri,  9 Jul 2021 13:42:24 +0200	[thread overview]
Message-ID: <20210709114226.269670-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210709114226.269670-1-d.csapak@proxmox.com>

mostly copied from pve, but includes a realm displayeditfield
as well as the comment field

in contrast to the inputpanel in PVE, this is not extended
from a base input panel (where in pve the comment/realm/default/etc.
fields come from)

we do this, since not all products can define a default or tfa

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Makefile                 |  1 +
 src/Utils.js                 |  9 ++++
 src/window/AuthEditOpenId.js | 96 ++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 src/window/AuthEditOpenId.js

diff --git a/src/Makefile b/src/Makefile
index 0f094c6..41b4dc2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -73,6 +73,7 @@ JSSRC=					\
 	window/ACMEDomains.js		\
 	window/FileBrowser.js		\
 	window/AuthEditBase.js		\
+	window/AuthEditOpenId.js	\
 	node/APT.js			\
 	node/APTRepositories.js		\
 	node/NetworkEdit.js		\
diff --git a/src/Utils.js b/src/Utils.js
index 42cc02c..167679d 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -1158,6 +1158,15 @@ utilities: {
 	    edit: false,
 	    pwchange: true,
 	},
+	openid: {
+	    name: gettext('OpenID Connect Server'),
+	    ipanel: 'pmxAuthOpenIDPanel',
+	    add: true,
+	    edit: true,
+	    tfa: false,
+	    pwchange: false,
+	    iconCls: 'pmx-itype-icon-openid-logo',
+	},
     },
 
     // to add or change existing for product specific ones
diff --git a/src/window/AuthEditOpenId.js b/src/window/AuthEditOpenId.js
new file mode 100644
index 0000000..499e253
--- /dev/null
+++ b/src/window/AuthEditOpenId.js
@@ -0,0 +1,96 @@
+Ext.define('Proxmox.panel.OpenIDInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pmxAuthOpenIDPanel',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    type: 'openid',
+
+    onGetValues: function(values) {
+	let me = this;
+
+	if (me.isCreate) {
+	    values.type = me.type;
+	}
+
+	return values;
+    },
+
+    columnT: [
+	{
+	    xtype: 'textfield',
+	    name: 'issuer-url',
+	    fieldLabel: gettext('Issuer URL'),
+	    allowBlank: false,
+	},
+    ],
+
+    column1: [
+	{
+	    xtype: 'pmxDisplayEditField',
+	    name: 'realm',
+	    cbind: {
+		value: '{realm}',
+		editable: '{isCreate}',
+	    },
+	    fieldLabel: gettext('Realm'),
+	    allowBlank: false,
+	},
+	{
+	    xtype: 'proxmoxtextfield',
+	    fieldLabel: gettext('Client ID'),
+	    name: 'client-id',
+	    allowBlank: false,
+	},
+	{
+	    xtype: 'proxmoxtextfield',
+	    fieldLabel: gettext('Client Key'),
+	    cbind: {
+		deleteEmpty: '{!isCreate}',
+	    },
+	    name: 'client-key',
+	},
+    ],
+
+    column2: [
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('Autocreate Users'),
+	    name: 'autocreate',
+	    value: 0,
+	    cbind: {
+		deleteEmpty: '{!isCreate}',
+	    },
+	},
+	{
+	    xtype: 'pmxDisplayEditField',
+	    name: 'username-claim',
+	    editConfig: {
+		xtype: 'proxmoxKVComboBox',
+	    },
+	    cbind: {
+		value: get => get('isCreate') ? '__default__' : Proxmox.Utils.defaultText,
+		deleteEmpty: '{!isCreate}',
+		editable: '{isCreate}',
+	    },
+	    fieldLabel: gettext('Username Claim'),
+	    comboItems: [
+		['__default__', Proxmox.Utils.defaultText],
+		['subject', 'subject'],
+		['username', 'username'],
+		['email', 'email'],
+	    ],
+	},
+    ],
+
+    columnB: [
+	{
+	    xtype: 'textfield',
+	    name: 'comment',
+	    fieldLabel: gettext('Comment'),
+	    cbind: {
+		deleteEmpty: '{!isCreate}',
+	    },
+	},
+    ],
+});
+
-- 
2.30.2





  parent reply	other threads:[~2021-07-09 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 11:42 [pve-devel] [PATCH widget-toolkit/manager] refactor realm ui Dominik Csapak
2021-07-09 11:42 ` [pve-devel] [PATCH widget-toolkit 1/4] add window/AuthEditBase from PVE Dominik Csapak
2021-07-09 11:42 ` [pve-devel] [PATCH widget-toolkit 2/4] Utils: add authSchema from PVE and make it overrideable Dominik Csapak
2021-07-09 11:42 ` [pve-devel] [PATCH widget-toolkit 3/4] add panel/AuthView from PVE Dominik Csapak
2021-07-09 11:42 ` Dominik Csapak [this message]
2021-07-09 11:42 ` [pve-devel] [PATCH manager 1/2] ui: use AuthView and authSchema from widget-toolkit Dominik Csapak
2021-07-09 11:42 ` [pve-devel] [PATCH manager 2/2] ui: remove PVE.dc.AuthEditBase window Dominik Csapak
2021-07-13  4:35 ` [pve-devel] partially-applied-series: [PATCH widget-toolkit/manager] refactor realm ui Thomas Lamprecht

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=20210709114226.269670-5-d.csapak@proxmox.com \
    --to=d.csapak@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 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal