mirror of
https://github.com/portainer/portainer.git
synced 2025-07-27 01:09:41 +02:00
feat(oauth): update configuration override UX
This commit is contained in:
parent
4a5fa211a7
commit
6711e6c969
2 changed files with 20 additions and 7 deletions
|
@ -11,6 +11,7 @@ angular.module('portainer.extensions.oauth')
|
|||
this.$onInit = onInit;
|
||||
this.onSelectProvider = onSelectProvider;
|
||||
this.onMicrosoftTenantIDChange = onMicrosoftTenantIDChange;
|
||||
this.resetProviderConfiguration = resetProviderConfiguration;
|
||||
|
||||
function onMicrosoftTenantIDChange() {
|
||||
var tenantID = ctrl.state.microsoftTenantID;
|
||||
|
@ -20,13 +21,25 @@ angular.module('portainer.extensions.oauth')
|
|||
ctrl.settings.ResourceURI = _.replace('https://graph.windows.net/TENANT_ID/me?api-version=2013-11-08', 'TENANT_ID', tenantID);
|
||||
}
|
||||
|
||||
function resetProviderConfiguration() {
|
||||
ctrl.settings.AuthorizationURI = ctrl.state.provider.authUrl;
|
||||
ctrl.settings.AccessTokenURI = ctrl.state.provider.accessTokenUrl;
|
||||
ctrl.settings.ResourceURI = ctrl.state.provider.resourceUrl;
|
||||
ctrl.settings.UserIdentifier = ctrl.state.provider.userIdentifier;
|
||||
ctrl.settings.Scopes = ctrl.state.provider.scopes;
|
||||
|
||||
if (ctrl.state.provider.name === 'microsoft' && ctrl.state.microsoftTenantID !== '') {
|
||||
onMicrosoftTenantIDChange();
|
||||
}
|
||||
}
|
||||
|
||||
function onSelectProvider(provider) {
|
||||
ctrl.state.provider = provider;
|
||||
ctrl.settings.AuthorizationURI = provider.authUrl;
|
||||
ctrl.settings.AccessTokenURI = provider.accessTokenUrl;
|
||||
ctrl.settings.ResourceURI = provider.resourceUrl;
|
||||
ctrl.settings.UserIdentifier = provider.userIdentifier;
|
||||
ctrl.settings.Scopes = provider.scopes;
|
||||
ctrl.settings.AuthorizationURI = ctrl.settings.AuthorizationURI === '' ? provider.authUrl : ctrl.settings.AuthorizationURI;
|
||||
ctrl.settings.AccessTokenURI = ctrl.settings.AccessTokenURI === '' ? provider.accessTokenUrl : ctrl.settings.AccessTokenURI;
|
||||
ctrl.settings.ResourceURI = ctrl.settings.ResourceURI === '' ? provider.resourceUrl : ctrl.settings.ResourceURI;
|
||||
ctrl.settings.UserIdentifier = ctrl.settings.UserIdentifier === '' ? provider.userIdentifier : ctrl.settings.UserIdentifier;
|
||||
ctrl.settings.Scopes = ctrl.settings.Scopes === '' ? provider.scopes : ctrl.settings.Scopes;
|
||||
|
||||
if (provider.name === 'microsoft' && ctrl.state.microsoftTenantID !== '') {
|
||||
onMicrosoftTenantIDChange();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue