diff --git a/dashboard/src/index.html b/dashboard/src/index.html index 50268a5ee..6193f9d7c 100644 --- a/dashboard/src/index.html +++ b/dashboard/src/index.html @@ -180,7 +180,7 @@
  • {{ 'branding.title' | tr }}
  • {{ 'domains.title' | tr }}
  • {{ 'emails.title' | tr }}
  • -
  • {{ 'users.settings.title' | tr }}
  • +
  • {{ 'users.title' | tr }}
  • {{ 'eventlog.title' | tr }}
  • {{ 'network.title' | tr }}
  • {{ 'services.title' | tr }}
  • diff --git a/dashboard/src/js/index.js b/dashboard/src/js/index.js index 5d8270370..37caa4ff9 100644 --- a/dashboard/src/js/index.js +++ b/dashboard/src/js/index.js @@ -96,8 +96,7 @@ app.config(['$routeProvider', function ($routeProvider) { controller: 'NotificationsController', templateUrl: 'views/notifications.html?<%= revision %>' }).when('/oidc', { - controller: 'OidcController', - templateUrl: 'views/oidc.html?<%= revision %>' + redirectTo: '/usersettings' }).when('/settings', { controller: 'SettingsController', templateUrl: 'views/settings.html?<%= revision %>' diff --git a/dashboard/src/views/oidc.html b/dashboard/src/views/oidc.html deleted file mode 100644 index 107850d19..000000000 --- a/dashboard/src/views/oidc.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - -
    - -
    -

    {{ 'oidc.title' | tr }}

    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'oidc.env.discoveryUrl' | tr }}https://{{ config.adminFqdn }}/.well-known/openid-configuration
    {{ 'oidc.env.authEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/auth
    {{ 'oidc.env.tokenEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/token
    {{ 'oidc.env.keysEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/jwks
    {{ 'oidc.env.profileEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/me
    {{ 'oidc.env.logoutUrl' | tr }}https://{{ config.adminFqdn }}/openid/session/end
    -
    -
    -
    -
    - -
    - -
    -

    {{ 'oidc.clients.title' | tr }}

    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - -
    {{ 'oidc.client.name' | tr }}{{ 'oidc.client.id' | tr }}{{ 'oidc.client.signingAlgorithm' | tr }}{{ 'main.actions' | tr }}
    {{ 'oidc.clients.empty' | tr }}
    - {{ client.name }} - - {{ client.id }} - - {{ client.tokenSignatureAlgorithm }} - - - -
    -
    -
    -
    -
    -
    diff --git a/dashboard/src/views/oidc.js b/dashboard/src/views/oidc.js deleted file mode 100644 index fc23fb685..000000000 --- a/dashboard/src/views/oidc.js +++ /dev/null @@ -1,149 +0,0 @@ -'use strict'; - -/* global angular */ -/* global $ */ - -angular.module('Application').controller('OidcController', ['$scope', '$location', 'Client', function ($scope, $location, Client) { - Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); }); - - $scope.user = Client.getUserInfo(); - $scope.config = Client.getConfig(); - $scope.clients = []; - - $scope.refreshClients = function () { - Client.getOidcClients(function (error, result) { - if (error) return console.error('Failed to load oidc clients', error); - - $scope.clients = result; - }); - }; - - $scope.clientAdd = { - busy: false, - error: {}, - id: '', - name: '', - secret: '', - loginRedirectUri: '', - tokenSignatureAlgorithm: '', - - show: function () { - $scope.clientAdd.id = ''; - $scope.clientAdd.secret = ''; - $scope.clientAdd.name = ''; - $scope.clientAdd.loginRedirectUri = ''; - $scope.clientAdd.tokenSignatureAlgorithm = 'RS256'; - $scope.clientAdd.busy = false; - $scope.clientAdd.error = null; - $scope.clientAddForm.$setPristine(); - - $('#clientAddModal').modal('show'); - }, - - submit: function () { - $scope.clientAdd.busy = true; - $scope.clientAdd.error = {}; - - Client.addOidcClient($scope.clientAdd.id, $scope.clientAdd.name, $scope.clientAdd.secret, $scope.clientAdd.loginRedirectUri, $scope.clientAdd.tokenSignatureAlgorithm, function (error) { - if (error) { - if (error.statusCode === 409) { - $scope.clientAdd.error.id = 'Client ID already exists'; - $('#clientId').focus(); - } else { - console.error('Unable to add openid client.', error); - } - - $scope.clientAdd.busy = false; - - return; - } - - $scope.refreshClients(); - $scope.clientAdd.busy = false; - - $('#clientAddModal').modal('hide'); - }); - } - }; - - $scope.clientEdit = { - busy: false, - error: {}, - id: '', - name: '', - secret: '', - loginRedirectUri: '', - tokenSignatureAlgorithm: '', - - show: function (client) { - $scope.clientEdit.id = client.id; - $scope.clientEdit.name = client.name; - $scope.clientEdit.secret = client.secret; - $scope.clientEdit.loginRedirectUri = client.loginRedirectUri; - $scope.clientEdit.tokenSignatureAlgorithm = client.tokenSignatureAlgorithm; - $scope.clientEdit.busy = false; - $scope.clientEdit.error = null; - $scope.clientEditForm.$setPristine(); - - $('#clientEditModal').modal('show'); - }, - - submit: function () { - $scope.clientEdit.busy = true; - $scope.clientEdit.error = {}; - - Client.updateOidcClient($scope.clientEdit.id, $scope.clientEdit.name, $scope.clientEdit.secret, $scope.clientEdit.loginRedirectUri, $scope.clientEdit.tokenSignatureAlgorithm, function (error) { - if (error) { - console.error('Unable to edit openid client.', error); - - $scope.clientEdit.busy = false; - - return; - } - - $scope.refreshClients(); - $scope.clientEdit.busy = false; - - $('#clientEditModal').modal('hide'); - }); - } - }; - - $scope.deleteClient = { - busy: false, - error: {}, - id: '', - - show: function (client) { - $scope.deleteClient.busy = false; - $scope.deleteClient.id = client.id; - - $('#clientDeleteModal').modal('show'); - }, - - submit: function () { - Client.delOidcClient($scope.deleteClient.id, function (error) { - $scope.deleteClient.busy = false; - - if (error) return console.error('Failed to delete openid client', error); - - $scope.refreshClients(); - - $('#clientDeleteModal').modal('hide'); - }); - } - }; - - Client.onReady(function () { - $scope.refreshClients(); - }); - - // setup all the dialog focus handling - ['clientAddModal', 'clientEditmodal'].forEach(function (id) { - $('#' + id).on('shown.bs.modal', function () { - $(this).find('[autofocus]:first').focus(); - }); - }); - - $('.modal-backdrop').remove(); -}]); diff --git a/dashboard/src/views/user-settings.html b/dashboard/src/views/user-settings.html index e08d45501..49718fdcf 100644 --- a/dashboard/src/views/user-settings.html +++ b/dashboard/src/views/user-settings.html @@ -99,15 +99,131 @@ + + + + + + + + + +

    - {{ 'users.settings.title' | tr }} + {{ 'users.title' | tr }}

    -
    +
    @@ -137,11 +253,11 @@
    -
    +

    {{ 'users.externalLdap.title' | tr }}

    -
    +
    {{ 'users.externalLdap.description' | tr }}
    @@ -296,11 +412,11 @@
    -
    +

    {{ 'users.exposedLdap.title' | tr }}

    -
    +
    {{ 'users.exposedLdap.description' | tr }}
    @@ -351,16 +467,85 @@
    -
    +

    {{ 'oidc.title' | tr }}

    -
    -
    -
    - {{ 'oidc.description' | tr }} - {{ 'main.settings' | tr }} +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'oidc.env.discoveryUrl' | tr }}https://{{ config.adminFqdn }}/.well-known/openid-configuration
    {{ 'oidc.env.authEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/auth
    {{ 'oidc.env.tokenEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/token
    {{ 'oidc.env.keysEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/jwks
    {{ 'oidc.env.profileEndpoint' | tr }}https://{{ config.adminFqdn }}/openid/me
    {{ 'oidc.env.logoutUrl' | tr }}https://{{ config.adminFqdn }}/openid/session/end
    +
    +
    +
    + +
    + +
    +

    {{ 'oidc.clients.title' | tr }}

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    {{ 'oidc.client.name' | tr }}{{ 'oidc.client.id' | tr }}{{ 'oidc.client.signingAlgorithm' | tr }}{{ 'main.actions' | tr }}
    {{ 'oidc.clients.empty' | tr }}
    + {{ client.name }} + + {{ client.id }} + + {{ client.tokenSignatureAlgorithm }} + + + +
    +
    +
    +
    diff --git a/dashboard/src/views/user-settings.js b/dashboard/src/views/user-settings.js index 1c991b2fc..74c54efd4 100644 --- a/dashboard/src/views/user-settings.js +++ b/dashboard/src/views/user-settings.js @@ -25,6 +25,7 @@ angular.module('Application').controller('UserSettingsController', ['$scope', '$ $scope.ready = false; $scope.config = Client.getConfig(); $scope.userInfo = Client.getUserInfo(); + $scope.oidcClients = []; $scope.profileConfig = { editableUserProfiles: true, @@ -287,10 +288,142 @@ angular.module('Application').controller('UserSettingsController', ['$scope', '$ } }; + $scope.refreshOIDCClients = function () { + Client.getOidcClients(function (error, result) { + if (error) return console.error('Failed to load oidc clients', error); + + $scope.oidcClients = result; + }); + }; + + $scope.clientAdd = { + busy: false, + error: {}, + id: '', + name: '', + secret: '', + loginRedirectUri: '', + tokenSignatureAlgorithm: '', + + show: function () { + $scope.clientAdd.id = ''; + $scope.clientAdd.secret = ''; + $scope.clientAdd.name = ''; + $scope.clientAdd.loginRedirectUri = ''; + $scope.clientAdd.tokenSignatureAlgorithm = 'RS256'; + $scope.clientAdd.busy = false; + $scope.clientAdd.error = null; + $scope.clientAddForm.$setPristine(); + + $('#oidcClientAddModal').modal('show'); + }, + + submit: function () { + $scope.clientAdd.busy = true; + $scope.clientAdd.error = {}; + + Client.addOidcClient($scope.clientAdd.id, $scope.clientAdd.name, $scope.clientAdd.secret, $scope.clientAdd.loginRedirectUri, $scope.clientAdd.tokenSignatureAlgorithm, function (error) { + if (error) { + if (error.statusCode === 409) { + $scope.clientAdd.error.id = 'Client ID already exists'; + $('#clientId').focus(); + } else { + console.error('Unable to add openid client.', error); + } + + $scope.clientAdd.busy = false; + + return; + } + + $scope.refreshOIDCClients(); + $scope.clientAdd.busy = false; + + $('#oidcClientAddModal').modal('hide'); + }); + } + }; + + $scope.clientEdit = { + busy: false, + error: {}, + id: '', + name: '', + secret: '', + loginRedirectUri: '', + tokenSignatureAlgorithm: '', + + show: function (client) { + $scope.clientEdit.id = client.id; + $scope.clientEdit.name = client.name; + $scope.clientEdit.secret = client.secret; + $scope.clientEdit.loginRedirectUri = client.loginRedirectUri; + $scope.clientEdit.tokenSignatureAlgorithm = client.tokenSignatureAlgorithm; + $scope.clientEdit.busy = false; + $scope.clientEdit.error = null; + $scope.clientEditForm.$setPristine(); + + $('#oidcClientEditModal').modal('show'); + }, + + submit: function () { + $scope.clientEdit.busy = true; + $scope.clientEdit.error = {}; + + Client.updateOidcClient($scope.clientEdit.id, $scope.clientEdit.name, $scope.clientEdit.secret, $scope.clientEdit.loginRedirectUri, $scope.clientEdit.tokenSignatureAlgorithm, function (error) { + if (error) { + console.error('Unable to edit openid client.', error); + + $scope.clientEdit.busy = false; + + return; + } + + $scope.refreshOIDCClients(); + $scope.clientEdit.busy = false; + + $('#oidcClientEditModal').modal('hide'); + }); + } + }; + + $scope.deleteClient = { + busy: false, + error: {}, + id: '', + + show: function (client) { + $scope.deleteClient.busy = false; + $scope.deleteClient.id = client.id; + + $('#oidcClientDeleteModal').modal('show'); + }, + + submit: function () { + Client.delOidcClient($scope.deleteClient.id, function (error) { + $scope.deleteClient.busy = false; + + if (error) return console.error('Failed to delete openid client', error); + + $scope.refreshOIDCClients(); + + $('#oidcClientDeleteModal').modal('hide'); + }); + } + }; + Client.onReady(function () { $scope.externalLdap.refresh(); $scope.profileConfig.refresh(); $scope.userDirectoryConfig.refresh(); + $scope.refreshOIDCClients(); + }); + + // setup all the dialog focus handling + ['oidcClientAddModal', 'oidcClientEditModal'].forEach(function (id) { + $('#' + id).on('shown.bs.modal', function () { + $(this).find('[autofocus]:first').focus(); + }); }); new Clipboard('#userDirectoryUrlClipboardButton').on('success', function(e) { diff --git a/dashboard/src/views/users.html b/dashboard/src/views/users.html index e7aab9621..96b7646a8 100644 --- a/dashboard/src/views/users.html +++ b/dashboard/src/views/users.html @@ -451,7 +451,7 @@

    - {{ 'users.title' | tr }} + {{ 'main.navbar.users' | tr }}