mirror of
https://github.com/portainer/portainer.git
synced 2025-08-08 07:15:23 +02:00
feat(oauth): dev build supporting Oauth extension
This commit is contained in:
parent
086bad2956
commit
7643f8d08c
13 changed files with 114 additions and 178 deletions
|
@ -62,5 +62,20 @@ angular.module('portainer.app')
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
service.OAuthAuthenticationEnabled = function() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
service.extensions(false)
|
||||
.then(function onSuccess(extensions) {
|
||||
var extensionAvailable = _.find(extensions, { Id: 2, Enabled: true }) ? true : false;
|
||||
deferred.resolve(extensionAvailable);
|
||||
})
|
||||
.catch(function onError(err) {
|
||||
deferred.reject(err);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<p>LDAP authentication</p>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<div ng-if="oauthAuthenticationAvailable">
|
||||
<input type="radio" id="registry_auth" ng-model="settings.AuthenticationMethod" ng-value="3">
|
||||
<label for="registry_auth">
|
||||
<div class="boxselector_header">
|
||||
|
@ -47,6 +47,16 @@
|
|||
<p>OAuth authentication</p>
|
||||
</label>
|
||||
</div>
|
||||
<div style="color: #767676;" ng-click="goToOAuthExtensionView()" ng-if="!oauthAuthenticationAvailable">
|
||||
<input type="radio" id="registry_auth" ng-model="settings.AuthenticationMethod" ng-value="3" disabled>
|
||||
<label for="registry_auth" tooltip-append-to-body="true" tooltip-placement="bottom" tooltip-class="portainer-tooltip" uib-tooltip="Feature available via an extension" style="cursor:pointer; border-color: #767676">
|
||||
<div class="boxselector_header">
|
||||
<i class="fa fa-users" aria-hidden="true" style="margin-right: 2px;"></i>
|
||||
OAuth (extension)
|
||||
</div>
|
||||
<p>OAuth authentication</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
angular.module('portainer.app')
|
||||
.controller('SettingsAuthenticationController', ['$q', '$scope', 'Notifications', 'SettingsService', 'FileUploadService', 'TeamService',
|
||||
function ($q, $scope, Notifications, SettingsService, FileUploadService, TeamService) {
|
||||
.controller('SettingsAuthenticationController', ['$q', '$scope', '$state', 'Notifications', 'SettingsService', 'FileUploadService', 'TeamService', 'ExtensionService',
|
||||
function($q, $scope, $state, Notifications, SettingsService, FileUploadService, TeamService, ExtensionService) {
|
||||
|
||||
$scope.state = {
|
||||
successfulConnectivityCheck: false,
|
||||
|
@ -14,6 +14,10 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService, TeamSer
|
|||
TLSCACert: ''
|
||||
};
|
||||
|
||||
$scope.goToOAuthExtensionView = function() {
|
||||
$state.go('portainer.extensions.extension', { id: 2 });
|
||||
};
|
||||
|
||||
$scope.isOauthEnabled = function isOauthEnabled() {
|
||||
return $scope.settings && $scope.settings.AuthenticationMethod === 3;
|
||||
};
|
||||
|
@ -25,7 +29,7 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService, TeamSer
|
|||
$scope.removeSearchConfiguration = function(index) {
|
||||
$scope.LDAPSettings.SearchSettings.splice(index, 1);
|
||||
};
|
||||
|
||||
|
||||
$scope.addGroupSearchConfiguration = function() {
|
||||
$scope.LDAPSettings.GroupSearchSettings.push({ GroupBaseDN: '', GroupAttribute: '', GroupFilter: '' });
|
||||
};
|
||||
|
@ -98,14 +102,17 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService, TeamSer
|
|||
function initView() {
|
||||
$q.all({
|
||||
settings: SettingsService.settings(),
|
||||
teams: TeamService.teams()
|
||||
}).then(function success(data) {
|
||||
teams: TeamService.teams(),
|
||||
oauthAuthentication: ExtensionService.OAuthAuthenticationEnabled()
|
||||
})
|
||||
.then(function success(data) {
|
||||
var settings = data.settings;
|
||||
$scope.teams = data.teams;
|
||||
$scope.settings = settings;
|
||||
$scope.LDAPSettings = settings.LDAPSettings;
|
||||
$scope.OAuthSettings = settings.OAuthSettings;
|
||||
$scope.formValues.TLSCACert = settings.LDAPSettings.TLSConfig.TLSCACert;
|
||||
$scope.oauthAuthenticationAvailable = data.oauthAuthentication;
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve application settings');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue