Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/tools/auth0/handlers/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const allowedTenantFlags = [
'enable_apis_section',
'enable_pipeline2',
'enable_dynamic_client_registration',
'enable_custom_domain_in_emails',
'allow_legacy_tokeninfo_endpoint',
'enable_legacy_profile',
'enable_idtoken_api2',
Expand Down Expand Up @@ -233,9 +232,9 @@ export default class TenantHandler extends DefaultHandler {

if ((tenant.flags as Record<string, unknown>)?.enable_custom_domain_in_emails !== undefined) {
log.warn(
'The "enable_custom_domain_in_emails" tenant flag is deprecated. ' +
'Use the "is_default" field on customDomains to configure the default domain instead. ' +
'The flag will still be applied for now but will be removed in a future release.'
'The "enable_custom_domain_in_emails" tenant flag is deprecated and has been removed from management. ' +
'It will not be applied during import. ' +
'Use the "is_default" field on customDomains to configure the default domain instead.'
);
Comment on lines 234 to 238

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that enable_custom_domain_in_emails is removed from allowedTenantFlags, removeUnallowedTenantFlags() will already emit a generic incompatible flag warning for it.

So in the same import run the user sees two contradictory warnings, one says the flag can likely be removed from their config, the other says it has already been removed from management.

For example, with flags: { enable_custom_domain_in_emails: true } in their config, they'd see:

WARN: The following tenant flag has not been updated because deemed incompatible with the target tenant: enable_custom_domain_in_emails. This flag can likely be removed from the tenant definition file...

WARN: The "enable_custom_domain_in_emails" tenant flag is deprecated and has been removed from management. It will not be applied during import. Use the "is_default" field on customDomains instead.

}

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion test/e2e/testdata/lots-of-configuration/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ tenant:
change_pwd_flow_v1: false
enable_apis_section: false
enable_client_connections: false
enable_custom_domain_in_emails: false
enable_dynamic_client_registration: false
enable_legacy_logs_search_v2: false
enable_public_signup_user_exists_error: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"change_pwd_flow_v1": false,
"enable_apis_section": false,
"enable_client_connections": false,
"enable_custom_domain_in_emails": false,
"enable_dynamic_client_registration": false,
"enable_legacy_logs_search_v2": false,
"enable_public_signup_user_exists_error": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ tenant:
change_pwd_flow_v1: false
enable_apis_section: false
enable_client_connections: false
enable_custom_domain_in_emails: false
enable_dynamic_client_registration: false
enable_legacy_logs_search_v2: false
enable_public_signup_user_exists_error: true
Expand Down
8 changes: 6 additions & 2 deletions test/tools/auth0/handlers/tenant.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,16 @@ describe('#tenant handler', () => {
await processChanges.apply(handler, [{ tenant: { flags: proposedFlags } }]);
});

it('should log a deprecation warning when enable_custom_domain_in_emails is set', async () => {
it('should log a deprecation warning and not send enable_custom_domain_in_emails to the API', async () => {
const logWarnStub = sinon.stub(log, 'warn');
let capturedPayload: any = null;

const auth0 = {
tenants: {
settings: {
update: async () => {},
update: async (data) => {
capturedPayload = data;
},
},
},
};
Expand All @@ -256,6 +259,7 @@ describe('#tenant handler', () => {
]);

expect(logWarnStub.calledWithMatch('enable_custom_domain_in_emails')).to.equal(true);
expect(capturedPayload?.flags?.enable_custom_domain_in_emails).to.equal(undefined);

logWarnStub.restore();
});
Expand Down