Skip to content

Commit 0a56644

Browse files
committed
feat: add discovery domain handling to organizations
- src/tools/auth0/handlers/organizations.ts: implement discovery domain creation, update, and deletion logic - src/context/directory/handlers/organizations.ts: map discovery domains to remove computed field id - src/context/yaml/handlers/organizations.ts: map discovery domains to remove computed field id - src/tools/auth0/handlers/userAttributeProfiles.ts: format pagination call for clarity feat: add discovery domain support to organizations - src/context/directory/handlers/organizations.ts: check for existence of discovery_domains before accessing length - src/context/yaml/handlers/organizations.ts: check for existence of discovery_domains before accessing length - test/context/directory/organizations.test.js: update test cases to include discovery_domains in organization data - test/context/yaml/organizations.test.js: add discovery_domains to YAML organization test data - test/tools/auth0/handlers/organizations.tests.js: add sample discovery domain and update organization handler tests feat(clients.ts): rename multiResourceRefreshTokenPolicies to multiResourceRefreshTokenPoliciesSchema feat(clients.ts): add organization_usage, organization_require_behavior, and organization_discovery_methods to schema test(clients.tests.js): add tests for client creation with organization properties test(clients.tests.js): add tests for handling multiple organization discovery methods test(clients.tests.js): add test for updating client organization_usage while preserving organization_require_behavior test(clients.tests.js): add test for removing organization_discovery_methods by setting to null feat(clients.ts): allow organization_discovery_methods to accept null values - src/tools/auth0/handlers/clients.ts: change type from 'array' to ['array', 'null']
1 parent 4ce981f commit 0a56644

File tree

9 files changed

+637
-17
lines changed

9 files changed

+637
-17
lines changed

src/context/directory/handlers/organizations.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ async function dump(context: DirectoryContext): Promise<void> {
6161
});
6262
}
6363

64+
if (organization.discovery_domains && organization.discovery_domains.length > 0) {
65+
organization.discovery_domains = organization.discovery_domains.map((dd) => {
66+
// discovery_domains id is a computed field
67+
delete dd.id;
68+
69+
return {
70+
...dd,
71+
};
72+
});
73+
}
74+
6475
dumpJSON(organizationFile, organization);
6576
});
6677
}

src/context/yaml/handlers/organizations.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { YAMLHandler } from '.';
22
import YAMLContext from '..';
3-
import { Asset, ParsedAsset } from '../../../types';
3+
import { Asset } from '../../../types';
44

55
type ParsedOrganizations = {
66
organizations: Asset[] | null;
@@ -36,6 +36,16 @@ async function dump(context: YAMLContext): Promise<ParsedOrganizations> {
3636
};
3737
});
3838
}
39+
if (org.discovery_domains && org.discovery_domains.length > 0) {
40+
org.discovery_domains = org.discovery_domains.map((dd) => {
41+
// discovery_domains id is a computed field
42+
delete dd.id;
43+
44+
return {
45+
...dd,
46+
};
47+
});
48+
}
3949

4050
return org;
4151
}),

src/tools/auth0/handlers/clients.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Assets } from '../../../types';
22
import { paginate } from '../client';
33
import DefaultAPIHandler from './default';
44

5-
const multiResourceRefreshTokenPolicies = {
5+
const multiResourceRefreshTokenPoliciesSchema = {
66
type: ['array', 'null'],
77
description:
88
'A collection of policies governing multi-resource refresh token exchange (MRRT), defining how refresh tokens can be used across different resource servers',
@@ -79,7 +79,7 @@ export const schema = {
7979
type: ['object', 'null'],
8080
description: 'Refresh token configuration',
8181
properties: {
82-
policies: multiResourceRefreshTokenPolicies,
82+
policies: multiResourceRefreshTokenPoliciesSchema,
8383
},
8484
},
8585
token_quota: {
@@ -145,6 +145,21 @@ export const schema = {
145145
description:
146146
'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.',
147147
},
148+
organization_usage: {
149+
type: 'string',
150+
enum: ['deny', 'allow', 'require'],
151+
},
152+
organization_require_behavior: {
153+
type: 'string',
154+
enum: ['no_prompt', 'pre_login_prompt', 'post_login_prompt'],
155+
},
156+
organization_discovery_methods: {
157+
type: ['array', 'null'],
158+
items: {
159+
type: 'string',
160+
enum: ['email', 'organization_name'],
161+
},
162+
},
148163
},
149164
required: ['name'],
150165
},

0 commit comments

Comments
 (0)