-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up on Azure configuration #29482
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,12 @@ export default class AzureConfig extends Model { | |
@attr('string', { label: 'Tenant ID' }) tenantId; | ||
@attr('string', { label: 'Client ID' }) clientId; | ||
@attr('string', { sensitive: true }) clientSecret; // obfuscated, never returned by API | ||
@attr('string') environment; | ||
|
||
@attr('string', { | ||
subText: | ||
'This value can also be provided with the AZURE_ENVIRONMENT environment variable. If not specified, Vault will use Azure Public Cloud.', | ||
}) | ||
environment; | ||
|
||
@attr('string', { | ||
subText: | ||
|
@@ -34,8 +39,10 @@ export default class AzureConfig extends Model { | |
@attr({ | ||
label: 'Root password TTL', | ||
editType: 'ttl', | ||
helperTextDisabled: | ||
'Specifies how long the root password is valid for in Azure when rotate-root generates a new client secret. Defaults to 182 days or 6 months, 1 day and 13 hours.', | ||
// default is 15768000 sec. The api docs say 182 days, but this should be updated to 182.5 days. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to ask the backend about this, but for now I wanted to leave the note in the code because it's confusing when we formate the returned default to |
||
helperTextDisabled: 'Vault will use the default of 182 days.', | ||
helperTextEnabled: | ||
'Specifies how long the root password is valid for in Azure when rotate-root generates a new client secret.', | ||
}) | ||
rootPasswordTtl; | ||
|
||
|
@@ -64,11 +71,9 @@ export default class AzureConfig extends Model { | |
return !!this.identityTokenAudience || !!this.identityTokenTtl; | ||
} | ||
|
||
get isAccountPluginConfigured() { | ||
// clientSecret is not checked here because it's never return by the API | ||
// however it is an Azure account field | ||
return !!this.rootPasswordTtl; | ||
} | ||
// the "clientSecret" param is not checked because it's never return by the API. | ||
// thus we can never say for sure if the account accessType has been configured so we always return false | ||
isAccountPluginConfigured = false; | ||
|
||
/* GETTERS used to generate array of fields to be displayed in: | ||
1. details view | ||
|
@@ -91,18 +96,22 @@ export default class AzureConfig extends Model { | |
formFieldGroups(accessType = 'account') { | ||
const formFieldGroups = []; | ||
formFieldGroups.push({ | ||
default: ['subscriptionId', 'tenantId', 'clientId', 'environment'], | ||
default: ['subscriptionId', 'tenantId', 'clientId'], | ||
}); | ||
if (accessType === 'wif') { | ||
if (accessType === 'account') { | ||
formFieldGroups.push({ | ||
default: ['identityTokenAudience', 'identityTokenTtl'], | ||
default: ['clientSecret'], | ||
}); | ||
} | ||
if (accessType === 'account') { | ||
if (accessType === 'wif') { | ||
formFieldGroups.push({ | ||
default: ['clientSecret', 'rootPasswordTtl'], | ||
default: ['identityTokenAudience', 'identityTokenTtl'], | ||
}); | ||
} | ||
formFieldGroups.push({ | ||
'More options': ['environment', 'rootPasswordTtl'], | ||
}); | ||
|
||
return formFieldGroups; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,8 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
subscription_id: 'subscription-id', | ||
tenant_id: 'tenant-id', | ||
client_id: 'client-id', | ||
root_password_ttl: '20 days 20 hours', | ||
environment: 'AZUREPUBLICCLOUD', | ||
root_password_ttl: '1800000s', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should have passed in seconds originally as that's what the api does. |
||
}; | ||
this.server.get(`${path}/config`, () => { | ||
assert.true(true, 'request made to config when navigating to the configuration page.'); | ||
|
@@ -112,7 +112,8 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
}); | ||
|
||
module('create', function () { | ||
test('it should save azure account accessType options', async function (assert) { | ||
test('it should save azure account options', async function (assert) { | ||
// there are no azure specific options that can be returned from the API so confirm the generic options are saved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very similar acceptance tests that we do for GCP as it too cannot check if GCP specific options where set. |
||
assert.expect(3); | ||
const path = `azure-${this.uid}`; | ||
await enablePage.enable(this.type, path); | ||
|
@@ -125,18 +126,15 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
|
||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig(this.type); | ||
await fillInAzureConfig(); | ||
await click(GENERAL.saveButton); | ||
assert.true( | ||
this.flashSuccessSpy.calledWith(`Successfully saved ${path}'s configuration.`), | ||
'Success flash message is rendered showing the azure model configuration was saved.' | ||
); | ||
assert | ||
.dom(GENERAL.infoRowValue('Root password TTL')) | ||
.hasText( | ||
'1 hour 26 minutes 40 seconds', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I messed around some with the secret-engine-helper.js method |
||
'Root password TTL, an azure account specific field, has been set.' | ||
); | ||
.hasText('3 minutes 20 seconds', 'Root password TTL, a generic field, has been set.'); | ||
assert | ||
.dom(GENERAL.infoRowValue('Subscription ID')) | ||
.hasText('subscription-id', 'Subscription ID, a generic field, has been set.'); | ||
|
@@ -226,7 +224,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
|
||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig('azure'); | ||
await fillInAzureConfig(); | ||
await click(GENERAL.saveButton); | ||
|
||
assert.dom(GENERAL.messageError).hasText('Error welp, that did not work!', 'API error shows on form'); | ||
|
@@ -267,12 +265,15 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
identity_token_audience: 'audience', | ||
identity_token_ttl: 720000, | ||
environment: 'AZUREPUBLICCLOUD', | ||
root_password_ttl: '1800000s', | ||
}; | ||
this.server.get(`${path}/config`, () => { | ||
assert.true(true, 'request made to config when navigating to the configuration page.'); | ||
return { data: { id: path, type: this.type, ...wifAttrs } }; | ||
}); | ||
await enablePage.enable(this.type, path); | ||
GENERAL.toggleGroup('More options'); | ||
|
||
for (const key of expectedConfigKeys('azure-wif')) { | ||
const responseKeyAndValue = expectedValueOfConfigKeys(this.type, key); | ||
assert | ||
|
@@ -362,7 +363,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
|
||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig('withWif'); | ||
await fillInAzureConfig(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed this method to match the feedback on similar method with |
||
await click(GENERAL.saveButton); | ||
assert.dom(SES.wif.issuerWarningModal).doesNotExist('issuer warning modal does not show'); | ||
assert.true( | ||
|
@@ -392,7 +393,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
|
||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig('withWif'); | ||
await fillInAzureConfig(true); | ||
assert | ||
.dom(GENERAL.inputByAttr('issuer')) | ||
.hasValue(oldIssuer, 'issuer defaults to previously saved value'); | ||
|
@@ -434,7 +435,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
|
||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig('withWif'); | ||
await fillInAzureConfig(true); | ||
assert | ||
.dom(GENERAL.inputByAttr('issuer')) | ||
.hasValue(oldIssuer, 'issuer defaults to previously saved value'); | ||
|
@@ -465,7 +466,7 @@ module('Acceptance | Azure | configuration', function (hooks) { | |
await enablePage.enable(this.type, path); | ||
await click(SES.configTab); | ||
await click(SES.configure); | ||
await fillInAzureConfig('withWif'); | ||
await fillInAzureConfig(true); | ||
await click(GENERAL.saveButton); // finished creating attributes, go back and edit them. | ||
assert | ||
.dom(GENERAL.infoRowValue('Identity token audience')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text was in the full Azure build out designs, and it seemed helpful so I added.