auth0 3.4.0 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +19 -15
  2. package/package.json +47 -33
  3. package/CHANGELOG.md +0 -685
  4. package/src/Auth0RestClient.js +0 -123
  5. package/src/RetryRestClient.js +0 -105
  6. package/src/auth/DatabaseAuthenticator.js +0 -282
  7. package/src/auth/OAUthWithIDTokenValidation.js +0 -124
  8. package/src/auth/OAuthAuthenticator.js +0 -405
  9. package/src/auth/PasswordlessAuthenticator.js +0 -303
  10. package/src/auth/TokensManager.js +0 -254
  11. package/src/auth/UsersManager.js +0 -161
  12. package/src/auth/clientAuthentication.js +0 -86
  13. package/src/auth/idToken.js +0 -167
  14. package/src/auth/index.js +0 -573
  15. package/src/errors.js +0 -60
  16. package/src/index.js +0 -11
  17. package/src/index.mjs +0 -4
  18. package/src/management/ActionsManager.js +0 -526
  19. package/src/management/AttackProtectionManager.js +0 -158
  20. package/src/management/BaseManager.js +0 -41
  21. package/src/management/BlacklistedTokensManager.js +0 -67
  22. package/src/management/BrandingManager.js +0 -250
  23. package/src/management/ClientCredentialsManager.js +0 -112
  24. package/src/management/ClientGrantsManager.js +0 -124
  25. package/src/management/ClientsManager.js +0 -184
  26. package/src/management/ConnectionsManager.js +0 -213
  27. package/src/management/CustomDomainsManager.js +0 -141
  28. package/src/management/DeviceCredentialsManager.js +0 -91
  29. package/src/management/EmailProviderManager.js +0 -101
  30. package/src/management/EmailTemplatesManager.js +0 -90
  31. package/src/management/GrantsManager.js +0 -84
  32. package/src/management/GuardianManager.js +0 -361
  33. package/src/management/HooksManager.js +0 -295
  34. package/src/management/JobsManager.js +0 -324
  35. package/src/management/LogStreamsManager.js +0 -136
  36. package/src/management/LogsManager.js +0 -82
  37. package/src/management/ManagementTokenProvider.js +0 -144
  38. package/src/management/MigrationsManager.js +0 -76
  39. package/src/management/OrganizationsManager.js +0 -721
  40. package/src/management/PromptsManager.js +0 -162
  41. package/src/management/ResourceServersManager.js +0 -143
  42. package/src/management/RolesManager.js +0 -329
  43. package/src/management/RulesConfigsManager.js +0 -86
  44. package/src/management/RulesManager.js +0 -148
  45. package/src/management/StatsManager.js +0 -84
  46. package/src/management/TenantManager.js +0 -76
  47. package/src/management/TicketsManager.js +0 -104
  48. package/src/management/UserBlocksManager.js +0 -121
  49. package/src/management/UsersManager.js +0 -882
  50. package/src/management/index.js +0 -3409
  51. package/src/utils.js +0 -60
@@ -1,184 +0,0 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const BaseManager = require('./BaseManager');
3
-
4
- /**
5
- * Auth0 Clients Manager.
6
- *
7
- * {@link https://auth0.com/docs/api/v2#!/Clients Clients} represent
8
- * applications.
9
- * You can learn more about this in the
10
- * {@link https://auth0.com/docs/applications Applications} section of the
11
- * documentation.
12
- */
13
- class ClientsManager extends BaseManager {
14
- /**
15
- * @param {object} options The client options.
16
- * @param {string} options.baseUrl The URL of the API.
17
- * @param {object} [options.headers] Headers to be included in all requests.
18
- * @param {object} [options.retry] Retry Policy Config
19
- */
20
- constructor(options) {
21
- super(options);
22
-
23
- /**
24
- * Provides an abstraction layer for consuming the
25
- * {@link https://auth0.com/docs/api/v2#!/Clients Auth0 Clients endpoint}.
26
- *
27
- * @type {external:RestClient}
28
- */
29
- this.resource = this._getRestClient('/clients/:client_id');
30
-
31
- /**
32
- * Provides an abstraction layer for consuming the
33
- * {@link https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret Auth0 Clients Rotate a client secret}.
34
- *
35
- * @type {external:RestClient}
36
- */
37
- this.rotateSecretResource = this._getRestClient('/clients/:client_id/rotate-secret');
38
- }
39
-
40
- /**
41
- * Create an Auth0 client.
42
- *
43
- * @example
44
- * management.clients.create(data, function (err) {
45
- * if (err) {
46
- * // Handle error.
47
- * }
48
- *
49
- * // Client created.
50
- * });
51
- * @param {object} data The client data object.
52
- * @param {Function} [cb] Callback function.
53
- * @returns {Promise|undefined}
54
- */
55
- create(...args) {
56
- return this.resource.create(...args);
57
- }
58
-
59
- /**
60
- * Get all Auth0 clients.
61
- *
62
- * @example <caption>
63
- * This method takes an optional object as first argument that may be used to
64
- * specify pagination settings. If pagination options are not present,
65
- * the first page of a limited number of results will be returned.
66
- * </caption>
67
- *
68
- * // Pagination settings.
69
- * var params = {
70
- * per_page: 10,
71
- * page: 0
72
- * };
73
- *
74
- * management.clients.getAll(params, function (err, clients) {
75
- * console.log(clients.length);
76
- * });
77
- * @param {object} [params] Clients parameters.
78
- * @param {number} [params.per_page] Number of results per page.
79
- * @param {number} [params.page] Page number, zero indexed.
80
- * @param {Function} [cb] Callback function.
81
- * @returns {Promise|undefined}
82
- */
83
- getAll(...args) {
84
- return this.resource.getAll(...args);
85
- }
86
-
87
- /**
88
- * Get an Auth0 client.
89
- *
90
- * @example
91
- * management.clients.get({ client_id: CLIENT_ID }, function (err, client) {
92
- * if (err) {
93
- * // Handle error.
94
- * }
95
- *
96
- * console.log(client);
97
- * });
98
- * @param {object} params Client parameters.
99
- * @param {string} params.client_id Application client ID.
100
- * @param {string} params.fields Comma-separated list of fields to include or exclude (based on value provided for include_fields).
101
- * @param {string} params.include_fields Whether specified fields are to be included (true) or excluded (false).
102
- * @param {Function} [cb] Callback function.
103
- * @returns {Promise|undefined}
104
- */
105
- get(...args) {
106
- return this.resource.get(...args);
107
- }
108
-
109
- /**
110
- * Update an Auth0 client.
111
- *
112
- * @example
113
- * var data = { name: 'newClientName' };
114
- * var params = { client_id: CLIENT_ID };
115
- *
116
- * management.clients.update(params, data, function (err, client) {
117
- * if (err) {
118
- * // Handle error.
119
- * }
120
- *
121
- * console.log(client.name); // 'newClientName'
122
- * });
123
- * @param {object} params Client parameters.
124
- * @param {string} params.client_id Application client ID.
125
- * @param {object} data Updated client data.
126
- * @param {Function} [cb] Callback function.
127
- * @returns {Promise|undefined}
128
- */
129
- update(...args) {
130
- return this.resource.patch(...args);
131
- }
132
-
133
- /**
134
- * Delete an Auth0 client.
135
- *
136
- * @example
137
- * management.clients.delete({ client_id: CLIENT_ID }, function (err) {
138
- * if (err) {
139
- * // Handle error.
140
- * }
141
- *
142
- * // Client deleted.
143
- * });
144
- * @param {object} params Client parameters.
145
- * @param {string} params.client_id Application client ID.
146
- * @param {Function} [cb] Callback function.
147
- * @returns {Promise|undefined}
148
- */
149
- delete(...args) {
150
- return this.resource.delete(...args);
151
- }
152
-
153
- /**
154
- * Rotate a client secret
155
- *
156
- * @example
157
- * management.clients.rotateClientSecret({ client_id: CLIENT_ID }, function (err, user) {
158
- * if (err) {
159
- * // Handle error.
160
- * }
161
- *
162
- * // Client secret rotated.
163
- * });
164
- * @param {object} params params object
165
- * @param {string} params.client_id Application client ID.
166
- * @returns {Promise|undefined}
167
- */
168
- rotateClientSecret(params, cb) {
169
- const query = params || {};
170
-
171
- // Require a client ID.
172
- if (!params.client_id) {
173
- throw new ArgumentError('The client_id cannot be null or undefined');
174
- }
175
-
176
- if (cb && cb instanceof Function) {
177
- return this.rotateSecretResource.create(query, {}, cb);
178
- }
179
-
180
- return this.rotateSecretResource.create(query, {});
181
- }
182
- }
183
-
184
- module.exports = ClientsManager;
@@ -1,213 +0,0 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const BaseManager = require('./BaseManager');
3
-
4
- /**
5
- * Represents the relationship between Auth0 and an Identity provider.
6
- */
7
- class ConnectionsManager extends BaseManager {
8
- /**
9
- * @param {object} options The client options.
10
- * @param {string} options.baseUrl The URL of the API.
11
- * @param {object} [options.headers] Headers to be included in all requests.
12
- * @param {object} [options.retry] Retry Policy Config
13
- */
14
- constructor(options) {
15
- super(options);
16
-
17
- /**
18
- * Provides an abstraction layer for performing CRUD operations on
19
- * {@link https://auth0.com/docs/api/v2#!/ConnectionsManagers Auth0
20
- * Connections}.
21
- *
22
- * @type {external:RestClient}
23
- */
24
- this.resource = this._getRestClient('/connections/:id');
25
-
26
- this.status = this._getRestClient('/connections/:id/status');
27
-
28
- /**
29
- * Provides an abstraction layer for consuming the
30
- * {@link https://auth0.com/docs/api/management/v2#!/Connections/delete_users_by_email
31
- * endpoint}.
32
- *
33
- * @type {external:RestClient}
34
- */
35
- this.user = this._getRestClient('/connections/:id/users');
36
- }
37
-
38
- /**
39
- * Create a new connection.
40
- *
41
- * @example
42
- * management.connections.create(data, function (err) {
43
- * if (err) {
44
- * // Handle error.
45
- * }
46
- *
47
- * // Connection created.
48
- * });
49
- * @param {object} data Connection data object.
50
- * @param {Function} [cb] Callback function.
51
- * @returns {Promise|undefined}
52
- */
53
- create(...args) {
54
- return this.resource.create(...args);
55
- }
56
-
57
- /**
58
- * Get all connections.
59
- *
60
- * @example <caption>
61
- * This method takes an optional object as first argument that may be used to
62
- * specify pagination settings. If pagination options are not present,
63
- * the first page of a limited number of results will be returned.
64
- * </caption>
65
- *
66
- * // Pagination settings.
67
- * var params = {
68
- * per_page: 10,
69
- * page: 0
70
- * };
71
- *
72
- * management.connections.getAll(params, function (err, connections) {
73
- * console.log(connections.length);
74
- * });
75
- * @param {object} [params] Connections params.
76
- * @param {number} [params.per_page] Number of results per page.
77
- * @param {number} [params.page] Page number, zero indexed.
78
- * @param {string[]} [params.fields] List of fields to include or exclude
79
- * @param {boolean} [params.include_fields] true if the fields specified are to be included in the result, false otherwise. Default true
80
- * @param {boolean} [params.include_totals] true if a query summary must be included in the result, false otherwise. Default false
81
- * @param {string} [params.strategy] Provide strategies to only retrieve connections with such strategies
82
- * @param {string} [params.name] Provide the name of the connection to retrieve
83
- * @param {Function} [cb] Callback function.
84
- * @returns {Promise|undefined}
85
- */
86
- getAll(...args) {
87
- return this.resource.getAll(...args);
88
- }
89
-
90
- /**
91
- * Get an Auth0 connection.
92
- *
93
- * @example
94
- * management.connections.get({ id: CONNECTION_ID }, function (err, connection) {
95
- * if (err) {
96
- * // Handle error.
97
- * }
98
- *
99
- * console.log(connection);
100
- * });
101
- * @param {object} params Connection parameters.
102
- * @param {string} params.id Connection ID.
103
- * @param {Function} [cb] Callback function.
104
- * @returns {Promise|undefined}
105
- */
106
- get(...args) {
107
- return this.resource.get(...args);
108
- }
109
-
110
- /**
111
- * Update an existing connection.
112
- *
113
- * @example
114
- * var data = { name: 'newConnectionName' };
115
- * var params = { id: CONNECTION_ID };
116
- *
117
- * management.connections.update(params, data, function (err, connection) {
118
- * if (err) {
119
- * // Handle error.
120
- * }
121
- *
122
- * console.log(connection.name); // 'newConnectionName'
123
- * });
124
- * @param {object} params Connection parameters.
125
- * @param {string} params.id Connection ID.
126
- * @param {object} data Updated connection data.
127
- * @param {Function} [cb] Callback function.
128
- * @returns {Promise|undefined}
129
- */
130
- update(...args) {
131
- return this.resource.patch(...args);
132
- }
133
-
134
- /**
135
- * Delete an existing connection.
136
- *
137
- * @example
138
- * management.connections.delete({ id: CONNECTION_ID }, function (err) {
139
- * if (err) {
140
- * // Handle error.
141
- * }
142
- *
143
- * // Connection deleted.
144
- * });
145
- * @param {object} params Connection parameters.
146
- * @param {string} params.id Connection ID.
147
- * @param {Function} [cb] Callback function.
148
- * @returns {Promise|undefined}
149
- */
150
- delete(...args) {
151
- return this.resource.delete(...args);
152
- }
153
-
154
- /**
155
- * Checks the status of an ad/ldap connection referenced by its ID.
156
- *
157
- * @example
158
- * var params = {id : 'CONNECTION_ID'}
159
- * @example <caption>
160
- * This methods takes the connection ID and returns the status when online, or an error when offline.
161
- * </caption>
162
- *
163
- * management.connections.checkStatus( {id : 'CONNECTION_ID'}, function (err, status) {
164
- * if (err) {
165
- * console.log('OFFLINE', err);
166
- * } else {
167
- * console.log('ONLINE', status);
168
- * }
169
- * });
170
- * @param {object} params Connection parameters
171
- * @param {string} params.id ID of the Connection.
172
- * @param {Function} [cb] Callback function.
173
- * @returns {Promise|undefined}
174
- */
175
- checkStatus(...args) {
176
- return this.status.get(...args);
177
- }
178
-
179
- /**
180
- * Delete a connection user by email.
181
- *
182
- * @example
183
- * management.connections.deleteUserByEmail({ id: CONNECTION_ID, email:USER_EMAIL }, function (err) {
184
- * if (err) {
185
- * // Handle error.
186
- * }
187
- *
188
- * // User deleted.
189
- * });
190
- * @param {object} params Connection parameters.
191
- * @param {string} params.id Connection ID.
192
- * @param {string} params.email User Email.
193
- * @param {Function} [cb] Callback function.
194
- * @returns {Promise|undefined}
195
- */
196
- deleteUserByEmail(params, cb) {
197
- if (typeof params !== 'object' || typeof params.email !== 'string' || params.email.length < 1) {
198
- throw new ArgumentError('You must provide an email for the deleteUserByEmail method');
199
- }
200
-
201
- if (!params.id) {
202
- throw new ArgumentError('The connection id cannot be null or undefined');
203
- }
204
-
205
- if (cb && cb instanceof Function) {
206
- return this.user.delete(params, {}, cb);
207
- }
208
-
209
- return this.user.delete(params, {});
210
- }
211
- }
212
-
213
- module.exports = ConnectionsManager;
@@ -1,141 +0,0 @@
1
- const { ArgumentError } = require('rest-facade');
2
- const BaseManager = require('./BaseManager');
3
-
4
- /**
5
- * Auth0 Custom Domains Manager.
6
- *
7
- * {@link https://auth0.com/docs/api/management/v2#!/Custom_Domains/get_custom_domains CustomDomains} represent
8
- * custom domain names.
9
- * You can learn more about this in the
10
- * {@link https://auth0.com/docs/custom-domains CustomDomains} section of the
11
- * documentation.
12
- */
13
- class CustomDomainsManager extends BaseManager {
14
- /**
15
- * @param {object} options The client options.
16
- * @param {string} options.baseUrl The URL of the API.
17
- * @param {object} [options.headers] Headers to be included in all requests.
18
- * @param {object} [options.retry] Retry Policy Config
19
- */
20
- constructor(options) {
21
- super(options);
22
-
23
- /**
24
- * Provides an abstraction layer for consuming the
25
- * {@link https://auth0.com/docs/api/v2#!/Custom_Domains Auth0 Custom Domains endpoint}.
26
- *
27
- * @type {external:RestClient}
28
- */
29
- this.resource = this._getRestClient('/custom-domains/:id');
30
-
31
- /**
32
- * Provides an abstraction layer for consuming the
33
- * {@link https://auth0.com/docs/api/v2#!/Custom_Domains Auth0 Custom Domains Verify endpoint}.
34
- *
35
- * @type {external:RestClient}
36
- */
37
- this.vefifyResource = this._getRestClient('/custom-domains/:id/verify');
38
- }
39
-
40
- /**
41
- * Create an Auth0 Custom Domain.
42
- *
43
- * @example
44
- * management.customDomains.create(data, function (err) {
45
- * if (err) {
46
- * // Handle error.
47
- * }
48
- *
49
- * // CustomDomain created.
50
- * });
51
- * @param {object} data The custom domain data object.
52
- * @param {Function} [cb] Callback function.
53
- * @returns {Promise|undefined}
54
- */
55
- create(...args) {
56
- return this.resource.create(...args);
57
- }
58
-
59
- /**
60
- * Get all Auth0 CustomDomains.
61
- *
62
- * @example
63
- * management.customDomains.getAll(function (err, customDomains) {
64
- * console.log(customDomains.length);
65
- * });
66
- * @returns {Promise|undefined}
67
- */
68
- getAll(...args) {
69
- return this.resource.getAll(...args);
70
- }
71
-
72
- /**
73
- * Get a Custom Domain.
74
- *
75
- * @example
76
- * management.customDomains.get({ id: CUSTOM_DOMAIN_ID }, function (err, customDomain) {
77
- * if (err) {
78
- * // Handle error.
79
- * }
80
- *
81
- * console.log(customDomain);
82
- * });
83
- * @param {object} params Custom Domain parameters.
84
- * @param {string} params.id Custom Domain ID.
85
- * @param {Function} [cb] Callback function.
86
- * @returns {Promise|undefined}
87
- */
88
- get(...args) {
89
- return this.resource.get(...args);
90
- }
91
-
92
- /**
93
- * Verify a Custom Domain.
94
- *
95
- * @example
96
- * management.customDomains.verify({ id: CUSTOM_DOMAIN_ID }, function (err, customDomain) {
97
- * if (err) {
98
- * // Handle error.
99
- * }
100
- *
101
- * console.log(customDomain);
102
- * });
103
- * @param {object} params Custom Domain parameters.
104
- * @param {string} params.id Custom Domain ID.
105
- * @param {Function} [cb] Callback function.
106
- * @returns {Promise|undefined}
107
- */
108
- verify(params, cb) {
109
- if (!params || !params.id) {
110
- throw new ArgumentError('The custom domain id cannot be null or undefined');
111
- }
112
-
113
- if (cb && cb instanceof Function) {
114
- return this.vefifyResource.create(params, {}, cb);
115
- }
116
-
117
- return this.vefifyResource.create(params, {});
118
- }
119
-
120
- /**
121
- * Delete a Custom Domain.
122
- *
123
- * @example
124
- * management.customDomains.delete({ id: CUSTOM_DOMAIN_ID }, function (err) {
125
- * if (err) {
126
- * // Handle error.
127
- * }
128
- *
129
- * // CustomDomain deleted.
130
- * });
131
- * @param {object} params Custom Domain parameters.
132
- * @param {string} params.id Custom Domain ID.
133
- * @param {Function} [cb] Callback function.
134
- * @returns {Promise|undefined}
135
- */
136
- delete(...args) {
137
- return this.resource.delete(...args);
138
- }
139
- }
140
-
141
- module.exports = CustomDomainsManager;
@@ -1,91 +0,0 @@
1
- const BaseManager = require('./BaseManager');
2
-
3
- /**
4
- * Manages Auth0 Device Credentials.
5
- */
6
- class DeviceCredentialsManager extends BaseManager {
7
- /**
8
- * @param {object} options The client options.
9
- * @param {string} options.baseUrl The URL of the API.
10
- * @param {object} [options.headers] Headers to be included in all requests.
11
- * @param {object} [options.retry] Retry Policy Config
12
- */
13
- constructor(options) {
14
- super(options);
15
-
16
- /**
17
- * Options object for the RestClient instance.
18
- *
19
- * @type {object}
20
- */
21
-
22
- /**
23
- * Provides an abstraction layer for consuming the
24
- * {@link https://auth0.com/docs/api/v2#!/Device_Credentials
25
- * Auth0 DeviceCredentialsManagers endpoint}.
26
- *
27
- * @type {external:RestClient}
28
- */
29
- this.resource = this._getRestClient('/device-credentials/:id');
30
- }
31
-
32
- /**
33
- * Create an Auth0 credential.
34
- *
35
- * @example
36
- * management.deviceCredentials.create(data, function (err) {
37
- * if (err) {
38
- * // Handle error.
39
- * }
40
- *
41
- * // Credential created.
42
- * });
43
- * @param {object} data The device credential data object.
44
- * @param {Function} [cb] Callback function.
45
- * @returns {Promise|undefined}
46
- */
47
- createPublicKey(...args) {
48
- return this.resource.create(...args);
49
- }
50
-
51
- /**
52
- * Get all Auth0 credentials.
53
- *
54
- * @example
55
- * var params = {user_id: "USER_ID"};
56
- *
57
- * management.deviceCredentials.getAll(params, function (err, credentials) {
58
- * console.log(credentials.length);
59
- * });
60
- * @param {object} params Credential parameters.
61
- * @param {Function} [cb] Callback function.
62
- * @returns {Promise|undefined}
63
- */
64
- getAll(...args) {
65
- return this.resource.getAll(...args);
66
- }
67
-
68
- /**
69
- * Delete an Auth0 device credential.
70
- *
71
- * @example
72
- * var params = { id: CREDENTIAL_ID };
73
- *
74
- * management.deviceCredentials.delete(params, function (err) {
75
- * if (err) {
76
- * // Handle error.
77
- * }
78
- *
79
- * // Credential deleted.
80
- * });
81
- * @param {object} params Credential parameters.
82
- * @param {string} params.id Device credential ID.
83
- * @param {Function} [cb] Callback function.
84
- * @returns {Promise|undefined}
85
- */
86
- delete(...args) {
87
- return this.resource.delete(...args);
88
- }
89
- }
90
-
91
- module.exports = DeviceCredentialsManager;