auth0 2.38.1 → 2.41.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v2.41.0](https://github.com/auth0/node-auth0/tree/v2.41.0) (2022-05-20)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.40.0...v2.41.0)
|
|
6
|
+
|
|
7
|
+
**Added**
|
|
8
|
+
|
|
9
|
+
- Added ClientsManager.rotateClientSecret method [\#721](https://github.com/auth0/node-auth0/pull/721) ([sbmelvin](https://github.com/sbmelvin))
|
|
10
|
+
|
|
11
|
+
## [v2.40.0](https://github.com/auth0/node-auth0/tree/v2.40.0) (2022-02-11)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.39.0...v2.40.0)
|
|
14
|
+
|
|
15
|
+
**Added**
|
|
16
|
+
|
|
17
|
+
- [CAUTH-1270]: feat(attack protection): add three features (bf, sipt, bpd) [\#705](https://github.com/auth0/node-auth0/pull/705) ([sdwvit](https://github.com/sdwvit))
|
|
18
|
+
|
|
19
|
+
## [v2.39.0](https://github.com/auth0/node-auth0/tree/v2.39.0) (2022-01-31)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.38.1...v2.39.0)
|
|
22
|
+
|
|
23
|
+
**Added**
|
|
24
|
+
|
|
25
|
+
- feat: update draft deploy [\#702](https://github.com/auth0/node-auth0/pull/702) ([TwelveNights](https://github.com/TwelveNights))
|
|
26
|
+
|
|
3
27
|
## [v2.38.1](https://github.com/auth0/node-auth0/tree/v2.38.1) (2022-01-27)
|
|
4
28
|
|
|
5
29
|
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.38.0...v2.38.1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.41.0",
|
|
4
4
|
"description": "SDK for Auth0 API v2",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/auth0/node-auth0",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"axios": "^0.
|
|
37
|
+
"axios": "^0.26.1",
|
|
38
38
|
"form-data": "^3.0.1",
|
|
39
39
|
"jsonwebtoken": "^8.5.1",
|
|
40
40
|
"jwks-rsa": "^1.12.1",
|
|
@@ -531,6 +531,7 @@ class ActionsManager {
|
|
|
531
531
|
* @param {object} params Action parameters.
|
|
532
532
|
* @param {string} params.id Action ID.
|
|
533
533
|
* @param {string} params.version_id Action ID.
|
|
534
|
+
* @param {boolean} params.update_draft Update draft
|
|
534
535
|
* @param {Function} [cb] Callback function.
|
|
535
536
|
* @returns {Promise|undefined}
|
|
536
537
|
*/
|
|
@@ -542,11 +543,18 @@ class ActionsManager {
|
|
|
542
543
|
delete params.action_id;
|
|
543
544
|
}
|
|
544
545
|
|
|
546
|
+
const body = {};
|
|
547
|
+
|
|
548
|
+
if (params.update_draft) {
|
|
549
|
+
body.update_draft = params.update_draft;
|
|
550
|
+
delete params.update_draft;
|
|
551
|
+
}
|
|
552
|
+
|
|
545
553
|
if (cb && cb instanceof Function) {
|
|
546
|
-
return this.actionVersionDeploy.create(params,
|
|
554
|
+
return this.actionVersionDeploy.create(params, body, cb);
|
|
547
555
|
}
|
|
548
556
|
|
|
549
|
-
return this.actionVersionDeploy.create(params,
|
|
557
|
+
return this.actionVersionDeploy.create(params, body);
|
|
550
558
|
}
|
|
551
559
|
|
|
552
560
|
/**
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
const { ArgumentError } = require('rest-facade');
|
|
2
|
+
const Auth0RestClient = require('../Auth0RestClient');
|
|
3
|
+
const RetryRestClient = require('../RetryRestClient');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Simple facade for consuming a REST API endpoint.
|
|
7
|
+
*
|
|
8
|
+
* @external RestClient
|
|
9
|
+
* @see https://github.com/ngonzalvez/rest-facade
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
class AttackProtectionManager {
|
|
13
|
+
/**
|
|
14
|
+
* @class
|
|
15
|
+
* Abstracts interaction with the attack-protection endpoints.
|
|
16
|
+
* @class
|
|
17
|
+
* @param {object} options The client options.
|
|
18
|
+
* @param {string} options.baseUrl The URL of the API.
|
|
19
|
+
* @param {object} [options.headers] Headers to be included in all requests.
|
|
20
|
+
* @param {object} [options.retry] Retry Policy Config
|
|
21
|
+
* @param {object} [options.tokenProvider] Management API Token Provider
|
|
22
|
+
*/
|
|
23
|
+
constructor(options) {
|
|
24
|
+
if (options === null || typeof options !== 'object') {
|
|
25
|
+
throw new ArgumentError('Must provide manager options');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (options.baseUrl === null || options.baseUrl === undefined) {
|
|
29
|
+
throw new ArgumentError('Must provide a base URL for the API');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ('string' !== typeof options.baseUrl || options.baseUrl.length === 0) {
|
|
33
|
+
throw new ArgumentError('The provided base URL is invalid');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const clientOptions = {
|
|
37
|
+
errorFormatter: { message: 'message', name: 'error' },
|
|
38
|
+
headers: options.headers,
|
|
39
|
+
query: { repeatParams: false },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const bruteForceProtection = new Auth0RestClient(
|
|
43
|
+
`${options.baseUrl}/attack-protection/brute-force-protection`,
|
|
44
|
+
clientOptions,
|
|
45
|
+
options.tokenProvider
|
|
46
|
+
);
|
|
47
|
+
this.bruteForceProtection = new RetryRestClient(bruteForceProtection, options.retry);
|
|
48
|
+
|
|
49
|
+
const suspiciousIpThrottling = new Auth0RestClient(
|
|
50
|
+
`${options.baseUrl}/attack-protection/suspicious-ip-throttling`,
|
|
51
|
+
clientOptions,
|
|
52
|
+
options.tokenProvider
|
|
53
|
+
);
|
|
54
|
+
this.suspiciousIpThrottling = new RetryRestClient(suspiciousIpThrottling, options.retry);
|
|
55
|
+
|
|
56
|
+
const breachedPasswordDetection = new Auth0RestClient(
|
|
57
|
+
`${options.baseUrl}/attack-protection/breached-password-detection`,
|
|
58
|
+
clientOptions,
|
|
59
|
+
options.tokenProvider
|
|
60
|
+
);
|
|
61
|
+
this.breachedPasswordDetection = new RetryRestClient(breachedPasswordDetection, options.retry);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get the Brute Force Protection configuration.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* management.attackProtection.getBruteForceConfig(params, function (err, bruteForceConfig) {
|
|
69
|
+
* if (err) {
|
|
70
|
+
* // Handle error.
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* // Brute force config
|
|
74
|
+
* console.log(bruteForceConfig);
|
|
75
|
+
* });
|
|
76
|
+
* @param {object} params Brute force parameters (leave empty).
|
|
77
|
+
* @param {Function} [cb] Callback function.
|
|
78
|
+
* @returns {Promise|undefined}
|
|
79
|
+
*/
|
|
80
|
+
getBruteForceConfig(...args) {
|
|
81
|
+
return this.bruteForceProtection.get(...args);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Update the Brute Force Protection configuration.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* management.attackProtection.updateBruteForceConfig(params, data, function (err, bruteForceConfig) {
|
|
89
|
+
* if (err) {
|
|
90
|
+
* // Handle error.
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* // Brute force config
|
|
94
|
+
* console.log(bruteForceConfig);
|
|
95
|
+
* });
|
|
96
|
+
* @param {object} params Brute force parameters (leave empty).
|
|
97
|
+
* @param {object} data Updated brute force configuration.
|
|
98
|
+
* @param {Function} [cb] Callback function.
|
|
99
|
+
* @returns {Promise|undefined}
|
|
100
|
+
*/
|
|
101
|
+
updateBruteForceConfig(...args) {
|
|
102
|
+
return this.bruteForceProtection.patch(...args);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get the Suspicious IP Throttling configuration.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* management.attackProtection.getSuspiciousIpThrottlingConfig(params, function (err, suspiciousIpThrottlingConfig) {
|
|
110
|
+
* if (err) {
|
|
111
|
+
* // Handle error.
|
|
112
|
+
* }
|
|
113
|
+
*
|
|
114
|
+
* // Access suspicious IP throttling configuration
|
|
115
|
+
* console.log(suspiciousIpThrottlingConfig);
|
|
116
|
+
* });
|
|
117
|
+
* @param {object} params Suspicious IP throttling parameters (leave empty).
|
|
118
|
+
* @param {Function} [cb] Callback function.
|
|
119
|
+
* @returns {Promise|undefined}
|
|
120
|
+
*/
|
|
121
|
+
getSuspiciousIpThrottlingConfig(...args) {
|
|
122
|
+
return this.suspiciousIpThrottling.get(...args);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Update the Suspicious IP Throttling configuration.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* management.attackProtection.updateSuspiciousIpThrottlingConfig(params, data, function (err, suspiciousIpThrottlingConfig) {
|
|
130
|
+
* if (err) {
|
|
131
|
+
* // Handle error.
|
|
132
|
+
* }
|
|
133
|
+
*
|
|
134
|
+
* // Access suspicious IP throttling configuration
|
|
135
|
+
* console.log(suspiciousIpThrottlingConfig);
|
|
136
|
+
* });
|
|
137
|
+
* @param {object} params Suspicious IP throttling parameters (leave empty).
|
|
138
|
+
* @param {object} data Updated suspicious IP throttling configuration.
|
|
139
|
+
* @param {Function} [cb] Callback function.
|
|
140
|
+
* @returns {Promise|undefined}
|
|
141
|
+
*/
|
|
142
|
+
updateSuspiciousIpThrottlingConfig(...args) {
|
|
143
|
+
return this.suspiciousIpThrottling.patch(...args);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get the Breached Password Detection configuration.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* management.attackProtection.getBreachedPasswordDetectionConfig(params, function (err, breachedPasswordDetectionConfig) {
|
|
151
|
+
* if (err) {
|
|
152
|
+
* // Handle error.
|
|
153
|
+
* }
|
|
154
|
+
*
|
|
155
|
+
* // Access breached password detection configuration
|
|
156
|
+
* console.log(breachedPasswordDetectionConfig);
|
|
157
|
+
* });
|
|
158
|
+
* @param {object} params Breached password detection parameters (leave empty).
|
|
159
|
+
* @param {Function} [cb] Callback function.
|
|
160
|
+
* @returns {Promise|undefined}
|
|
161
|
+
*/
|
|
162
|
+
getBreachedPasswordDetectionConfig(...args) {
|
|
163
|
+
return this.breachedPasswordDetection.get(...args);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Update the breached password detection configuration.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* management.attackProtection.updateBreachedPasswordDetectionConfig(params, data, function (err, breachedPasswordDetectionConfig) {
|
|
171
|
+
* if (err) {
|
|
172
|
+
* // Handle error.
|
|
173
|
+
* }
|
|
174
|
+
*
|
|
175
|
+
* // Access breached password detection configuration
|
|
176
|
+
* console.log(breachedPasswordDetectionConfig);
|
|
177
|
+
* });
|
|
178
|
+
* @param {object} params Breached password detection parameters (leave empty).
|
|
179
|
+
* @param {object} data Updated breached password detection configuration.
|
|
180
|
+
* @param {Function} [cb] Callback function.
|
|
181
|
+
* @returns {Promise|undefined}
|
|
182
|
+
*/
|
|
183
|
+
updateBreachedPasswordDetectionConfig(...args) {
|
|
184
|
+
return this.breachedPasswordDetection.patch(...args);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
module.exports = AttackProtectionManager;
|
|
@@ -54,6 +54,19 @@ class ClientsManager {
|
|
|
54
54
|
options.tokenProvider
|
|
55
55
|
);
|
|
56
56
|
this.resource = new RetryRestClient(auth0RestClient, options.retry);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Provides an abstraction layer for consuming the
|
|
60
|
+
* {@link https://auth0.com/docs/api/management/v2#!/Clients/post_rotate_secret Auth0 Clients Rotate a client secret}.
|
|
61
|
+
*
|
|
62
|
+
* @type {external:RestClient}
|
|
63
|
+
*/
|
|
64
|
+
const auth0RotateSecretClient = new Auth0RestClient(
|
|
65
|
+
`${options.baseUrl}/clients/:client_id/rotate-secret`,
|
|
66
|
+
clientOptions,
|
|
67
|
+
options.tokenProvider
|
|
68
|
+
);
|
|
69
|
+
this.rotateSecretResource = new RetryRestClient(auth0RotateSecretClient, options.retry);
|
|
57
70
|
}
|
|
58
71
|
|
|
59
72
|
/**
|
|
@@ -166,6 +179,36 @@ class ClientsManager {
|
|
|
166
179
|
delete(...args) {
|
|
167
180
|
return this.resource.delete(...args);
|
|
168
181
|
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Rotate a client secret
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* management.clients.rotateClientSecret({ client_id: CLIENT_ID }, function (err, user) {
|
|
188
|
+
* if (err) {
|
|
189
|
+
* // Handle error.
|
|
190
|
+
* }
|
|
191
|
+
*
|
|
192
|
+
* // Client secret rotated.
|
|
193
|
+
* });
|
|
194
|
+
* @param {object} params params object
|
|
195
|
+
* @param {string} params.client_id Application client ID.
|
|
196
|
+
* @returns {Promise|undefined}
|
|
197
|
+
*/
|
|
198
|
+
rotateClientSecret(params, cb) {
|
|
199
|
+
const query = params || {};
|
|
200
|
+
|
|
201
|
+
// Require a client ID.
|
|
202
|
+
if (!params.client_id) {
|
|
203
|
+
throw new ArgumentError('The client_id cannot be null or undefined');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (cb && cb instanceof Function) {
|
|
207
|
+
return this.rotateSecretResource.create(query, {}, cb);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return this.rotateSecretResource.create(query, {});
|
|
211
|
+
}
|
|
169
212
|
}
|
|
170
213
|
|
|
171
214
|
module.exports = ClientsManager;
|
package/src/management/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const GrantsManager = require('./GrantsManager');
|
|
|
10
10
|
const UsersManager = require('./UsersManager');
|
|
11
11
|
const UserBlocksManager = require('./UserBlocksManager');
|
|
12
12
|
const ConnectionsManager = require('./ConnectionsManager');
|
|
13
|
+
const AttackProtectionManager = require('./AttackProtectionManager');
|
|
13
14
|
const BlacklistedTokensManager = require('./BlacklistedTokensManager');
|
|
14
15
|
const RulesManager = require('./RulesManager');
|
|
15
16
|
const DeviceCredentialsManager = require('./DeviceCredentialsManager');
|
|
@@ -360,6 +361,13 @@ class ManagementClient {
|
|
|
360
361
|
* @type {OrganizationsManager}
|
|
361
362
|
*/
|
|
362
363
|
this.organizations = new OrganizationsManager(managerOptions);
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Attack Protection Manager
|
|
367
|
+
*
|
|
368
|
+
* @type {AttackProtectionManager}
|
|
369
|
+
*/
|
|
370
|
+
this.attackProtection = new AttackProtectionManager(managerOptions);
|
|
363
371
|
}
|
|
364
372
|
|
|
365
373
|
/**
|
|
@@ -3218,10 +3226,10 @@ class ManagementClient {
|
|
|
3218
3226
|
}
|
|
3219
3227
|
|
|
3220
3228
|
/**
|
|
3221
|
-
*
|
|
3229
|
+
* Set the new universal login template.
|
|
3222
3230
|
*
|
|
3223
3231
|
* @example
|
|
3224
|
-
* management.setBrandingUniversalLoginTemplate({ template: "a template" }, function (err, template) {
|
|
3232
|
+
* management.setBrandingUniversalLoginTemplate({}, { template: "a template" }, function (err, template) {
|
|
3225
3233
|
* if (err) {
|
|
3226
3234
|
* // Handle error.
|
|
3227
3235
|
* }
|