]> git.proxmox.com Git - proxmox-backup.git/commitdiff
gui: tfa configuration
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 15 Jan 2021 10:06:18 +0000 (11:06 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Jan 2021 14:19:52 +0000 (15:19 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
www/Makefile
www/SystemConfiguration.js
www/config/WebauthnView.js [new file with mode: 0644]

index 3d8d4fa1857d7d8c50736570dd355fd0031191c9..c2d80c7444a56af760dc08ec48ff57e1699c3ff7 100644 (file)
@@ -30,6 +30,7 @@ JSSRC=                                                        \
        config/ACLView.js                               \
        config/SyncView.js                              \
        config/VerifyView.js                            \
+       config/WebauthnView.js                          \
        window/ACLEdit.js                               \
        window/AddTfaRecovery.js                        \
        window/AddTotp.js                               \
index d82396af6fad0ed13137f39d57c21da33f1e7322..025e0273dc3ff87570337273f0a65715c87300df 100644 (file)
@@ -44,6 +44,27 @@ Ext.define('PBS.SystemConfiguration', {
                },
            ],
        },
+       {
+           title: gettext('Authentication'),
+           itemId: 'authentication',
+           xtype: 'panel',
+           layout: {
+               type: 'vbox',
+               align: 'stretch',
+               multi: true,
+           },
+           defaults: {
+               collapsible: true,
+               animCollapse: false,
+               margin: '10 10 0 10',
+           },
+           items: [
+               {
+                   title: gettext('Webauthn'),
+                   xtype: 'pbsWebauthnConfigView',
+               },
+           ],
+       },
     ],
 
     initComponent: function() {
@@ -55,6 +76,11 @@ Ext.define('PBS.SystemConfiguration', {
        Ext.Array.forEach(networktime.query(), function(item) {
            item.relayEvents(networktime, ['activate', 'deactivate', 'destroy']);
        });
+
+       let authentication = me.getComponent('authentication');
+       Ext.Array.forEach(authentication.query(), function(item) {
+           item.relayEvents(authentication, ['activate', 'deactivate', 'destroy']);
+       });
     },
 });
 
diff --git a/www/config/WebauthnView.js b/www/config/WebauthnView.js
new file mode 100644 (file)
index 0000000..914abcd
--- /dev/null
@@ -0,0 +1,83 @@
+Ext.define('PBS.WebauthnConfigView', {
+    extend: 'Proxmox.grid.ObjectGrid',
+    alias: ['widget.pbsWebauthnConfigView'],
+
+    url: "/api2/json/config/access/tfa/webauthn",
+    cwidth1: 150,
+    interval: 1000,
+
+    rows: {
+       rp: {
+           header: gettext('Relying Party'),
+           required: true,
+       },
+       origin: {
+           header: gettext('Origin'),
+           required: true,
+       },
+       id: {
+           header: gettext('Id'),
+           required: true,
+       },
+    },
+
+    tbar: [
+       {
+           text: gettext("Edit"),
+           handler: 'runEditor',
+       },
+    ],
+    controller: {
+       xclass: 'Ext.app.ViewController',
+
+       runEditor: function() {
+           let win = Ext.create('PBS.WebauthnConfigEdit');
+           win.show();
+       },
+
+       startStore: function() { this.getView().getStore().rstore.startUpdate(); },
+       stopStore: function() { this.getView().getStore().rstore.stopUpdate(); },
+    },
+
+
+    listeners: {
+       itemdblclick: 'runEditor',
+       activate: 'startStore',
+       deactivate: 'stopStore',
+       destroy: 'stopStore',
+    },
+});
+
+Ext.define('PBS.WebauthnConfigEdit', {
+    extend: 'Proxmox.window.Edit',
+    alias: ['widget.pbsWebauthnConfigEdit'],
+
+    subject: gettext('Webauthn'),
+    url: "/api2/extjs/config/access/tfa/webauthn",
+    autoLoad: true,
+
+    fieldDefaults: {
+       labelWidth: 120,
+    },
+
+    items: [
+       {
+           xtype: 'textfield',
+           fieldLabel: gettext('Relying Party'),
+           name: 'rp',
+           allowBlank: false,
+       },
+       {
+           xtype: 'textfield',
+           fieldLabel: gettext('Origin'),
+           name: 'origin',
+           allowBlank: false,
+       },
+       {
+           xtype: 'textfield',
+           fieldLabel: gettext('id'),
+           name: 'id',
+           allowBlank: false,
+       },
+    ],
+});