Skip to content
16 changes: 7 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
"dependencies": {
"ajv": "^6.12.6",
"auth0": "^4.32.0",
"auth0": "^4.33.0",
"dot-prop": "^5.3.0",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
Expand Down
8 changes: 8 additions & 0 deletions src/tools/auth0/handlers/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ export const schema = {
description:
'The identifier of a resource server in your tenant. This property links a client to a resource server indicating that the client IS that resource server. Can only be set when app_type=resource_server.',
},
skip_non_verifiable_callback_uri_confirmation_prompt: {
type: 'boolean',
description: 'Whether to skip the confirmation prompt for non-verifiable callback URIs',
},
},
required: ['name'],
},
Expand All @@ -157,6 +161,7 @@ export type Client = {
resource_server_identifier?: string;
custom_login_page?: string;
custom_login_page_on?: boolean;
skip_non_verifiable_callback_uri_confirmation_prompt?: boolean;
};

export default class ClientHandler extends DefaultAPIHandler {
Expand Down Expand Up @@ -224,6 +229,9 @@ export default class ClientHandler extends DefaultAPIHandler {
delete item.refresh_token;
}
}
if (item.skip_non_verifiable_callback_uri_confirmation_prompt === undefined) {
item.skip_non_verifiable_callback_uri_confirmation_prompt = null;
}
return item;
});

Expand Down
14 changes: 14 additions & 0 deletions src/tools/auth0/handlers/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@ export default class TenantHandler extends DefaultHandler {
}
}

console.log(
'BEFORE Updating tenant',
updatedTenant.skip_non_verifiable_callback_uri_confirmation_prompt
);
// Normalize skip_non_verifiable_callback_uri_confirmation_prompt before processing
if (updatedTenant.skip_non_verifiable_callback_uri_confirmation_prompt === undefined) {
updatedTenant.skip_non_verifiable_callback_uri_confirmation_prompt = null;
}

console.log(
'AFTER Updating tenant',
updatedTenant.skip_non_verifiable_callback_uri_confirmation_prompt
);

if (updatedTenant && Object.keys(updatedTenant).length > 0) {
await this.client.tenants.updateSettings(updatedTenant);
this.updated += 1;
Expand Down
74 changes: 74 additions & 0 deletions test/tools/auth0/handlers/clients.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,35 @@ describe('#clients handler', () => {
expect(wasCreateCalled).to.be.equal(true);
});

it('should create client with skip_non_verifiable_callback_uri_confirmation_prompt', async () => {
let wasCreateCalled = false;
const clientWithSkipConfirmation = {
name: 'Client With Skip Confirmation',
skip_non_verifiable_callback_uri_confirmation_prompt: true,
};

const auth0 = {
clients: {
create: function (data) {
(() => expect(this).to.not.be.undefined)();
wasCreateCalled = true;
expect(data).to.be.an('object');
expect(data.name).to.equal('Client With Skip Confirmation');
expect(data.skip_non_verifiable_callback_uri_confirmation_prompt).to.equal(true);
return Promise.resolve({ data });
},
update: () => Promise.resolve({ data: [] }),
delete: () => Promise.resolve({ data: [] }),
getAll: (params) => mockPagedData(params, 'clients', []),
},
pool,
};
const handler = new clients.default({ client: pageClient(auth0), config });
const stageFn = Object.getPrototypeOf(handler).processChanges;
await stageFn.apply(handler, [{ clients: [clientWithSkipConfirmation] }]);
expect(wasCreateCalled).to.be.equal(true);
});

it('should get clients', async () => {
const auth0 = {
clients: {
Expand Down Expand Up @@ -340,6 +369,51 @@ describe('#clients handler', () => {
]);
});

it('should update client with skip_non_verifiable_callback_uri_confirmation_prompt', async () => {
const auth0 = {
clients: {
create: function (data) {
(() => expect(this).to.not.be.undefined)();
expect(data).to.be.an('array');
expect(data.length).to.equal(0);
return Promise.resolve({ data });
},
update: function (params, data) {
(() => expect(this).to.not.be.undefined)();
expect(params).to.be.an('object');
expect(params.client_id).to.equal('client1');
expect(data).to.be.an('object');
expect(data.skip_non_verifiable_callback_uri_confirmation_prompt).to.equal(false);

return Promise.resolve({ data });
},
delete: () => Promise.resolve({ data: [] }),
getAll: (params) =>
mockPagedData(params, 'clients', [
{
client_id: 'client1',
name: 'someClient',
},
]),
},
pool,
};

const handler = new clients.default({ client: pageClient(auth0), config });
const stageFn = Object.getPrototypeOf(handler).processChanges;

await stageFn.apply(handler, [
{
clients: [
{
name: 'someClient',
skip_non_verifiable_callback_uri_confirmation_prompt: false,
},
],
},
]);
});

it('should delete client and create another one instead', async () => {
const auth0 = {
clients: {
Expand Down
15 changes: 11 additions & 4 deletions test/tools/auth0/handlers/tenant.tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const { expect } = require('chai');

import TenantHandler from '../../../../src/tools/auth0/handlers/tenant';
import { expect } from 'chai';
import tenantHandler, {
allowedTenantFlags,
removeUnallowedTenantFlags,
Expand Down Expand Up @@ -65,11 +63,13 @@ describe('#tenant handler', () => {
data: {
friendly_name: 'Test',
default_directory: 'users',
skip_non_verifiable_callback_uri_confirmation_prompt: true,
},
}),
updateSettings: (data) => {
expect(data).to.be.an('object');
expect(data.sandbox_version).to.equal('4');
expect(data.skip_non_verifiable_callback_uri_confirmation_prompt).to.equal(null);
expect(data.flags).to.equal(undefined);
return Promise.resolve(data);
},
Expand All @@ -80,7 +80,14 @@ describe('#tenant handler', () => {
const handler = new tenantHandler({ client: auth0 });
const stageFn = Object.getPrototypeOf(handler).processChanges;

await stageFn.apply(handler, [{ tenant: { sandbox_version: '4' } }]);
await stageFn.apply(handler, [
{
tenant: {
sandbox_version: '4',
skip_non_verifiable_callback_uri_confirmation_prompt: null,
},
},
]);
});

it('should allow valid default_token_quota property in tenant', async () => {
Expand Down